Class: Modernize::VersionParsingContext
- Inherits:
-
Object
- Object
- Modernize::VersionParsingContext
- Defined in:
- lib/modernizer/version_parser.rb
Overview
Class for the context to executed the block in.
Instance Method Summary collapse
-
#initialize ⇒ VersionParsingContext
constructor
A new instance of VersionParsingContext.
-
#method_missing(method, *args, &block) ⇒ Object
Figures out which translations are done for each version.
-
#migration ⇒ Object
Returns all the translations for a verion.
Constructor Details
#initialize ⇒ VersionParsingContext
Returns a new instance of VersionParsingContext.
15 16 17 |
# File 'lib/modernizer/version_parser.rb', line 15 def initialize @maps = [] end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *args, &block) ⇒ Object
Figures out which translations are done for each version.
21 22 23 24 25 |
# File 'lib/modernizer/version_parser.rb', line 21 def method_missing(method, *args, &block) raise ArgumentError.new("wrong number of arguments (#{args.size} for 1)") if args.size != 1 raise NoMethodError.new("Undefined translation method #{method}") unless MapMethods.respond_to?(method) @maps << {name: method, field: args[0], block: block} end |
Instance Method Details
#migration ⇒ Object
Returns all the translations for a verion.
29 30 31 |
# File 'lib/modernizer/version_parser.rb', line 29 def migration @maps end |