Last active
June 21, 2017 18:42
-
-
Save gosukiwi/746845834ce168cc6689de3ee08f5838 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class BaseParser | |
| private | |
| # We use some reflection to prettify the parser depedencies. Basically, from | |
| # calling a `foo_parser` method is the same as doing `ParserFactory.build('foo_parser')`. | |
| # | |
| def method_missing(name, *args, &block) | |
| raise ArgumentError.new("Method #{name} does not exist.") unless name.to_s.end_with?('_parser') | |
| ParserFactory.build(name, *args, &block) | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment