class PIM::MigrationContext
Attributes
migrated_values[R]
migrated_version[R]
object_name[R]
raw_values[R]
Public Class Methods
new(args)
click to toggle source
Calls superclass method
PIM::MigrationDiscriminator::new
# File pim.rb, line 10467 def initialize args super @object_name = get_value(args, :object_name) @raw_values = PIM.unsymbolized_hash(get_value(args, :raw_values)) @migrated_values = {} @migrated_version = nil end
Public Instance Methods
current_version()
click to toggle source
# File pim.rb, line 10475 def current_version return @migrated_version || @from end
is_migrated?()
click to toggle source
# File pim.rb, line 10479 def is_migrated? return from != migrated_version end
migrate_values!(*args)
click to toggle source
# File pim.rb, line 10483 def migrate_values! *args version = @to values = {} if args.length == 1 arg = args[0] if is_hash?(arg) values = arg else version = arg end else version = args[0] values = args[1] end @migrated_version = version.to_s @migrated_values.merge!(PIM.unsymbolized_hash(values)) end
Also aliased as: migrate!, migrate_values
update_version!()
click to toggle source
# File pim.rb, line 10503 def update_version! @from = current_version @migrated_version = nil end