Skip to content

Transformer dependency injection? #234

@riddley

Description

@riddley

Is there a way to inject dependencies into a Parslet::Transformer ? I tried adding an initialize method to my subclass and calling super but I was getting errors. I also tried defining #something=(whatever) type methods but that didn't seem to work either.

In case a usecase is helpful, I'd like to replace a word in a transformer without hard-coding the replacement in the transformer. There are other use-cases too, but that's a simple one that I can't solve w/ a global/constant unfortunately.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions