class Modernize::BlockParsingContext
Class for the context in which the block will get run
Attributes
has_version[RW]
initial_version[RW]
order[RW]
translations[RW]
Public Class Methods
new()
click to toggle source
# File lib/modernizer/parser.rb, line 23 def initialize @translations = {} @initial_version = nil @has_version = false @order = :ascending end
Public Instance Methods
method_missing(method, *args, &block)
click to toggle source
Determines what versions there are and before + after if any.
# File lib/modernizer/parser.rb, line 32 def method_missing(method, *args, &block) raise NoMethodError.new("Undefined translation method #{method}") unless MetaMethods.respond_to?(method) MetaMethods.send(method, self, args, &block) end
migrations()
click to toggle source
Returns the struct of version block and translation sets throws an error if no block is provided for determining version.
# File lib/modernizer/parser.rb, line 40 def migrations raise VersionError.new('did not provide a way to determine version') unless @has_version CompiledMigrations.new(@translations, @initial_version, @order) end