class SchemaEvolutionManager::MigrationFile::AttributeValue

Attributes

attribute[R]
value[R]

Public Class Methods

new(attribute_name, value) click to toggle source
# File lib/schema-evolution-manager/migration_file.rb, line 26
def initialize(attribute_name, value)
  Preconditions.assert_class(attribute_name, String)
  @value = Preconditions.assert_class(value, String)

  @attribute = Attribute::ATTRIBUTES.find { |a| a.name == attribute_name }
  Preconditions.check_not_null(@attribute,
                               "Attribute with name[%s] not found. Must be one of: %s" %
                               [attribute_name, 
                                Attribute::ATTRIBUTES.map { |a| a.name }.join(" ")])

  Preconditions.check_state(@attribute.valid_values.include?(@value),
                            "Attribute[%s] - Invalid value[%s]. Must be one of: %s" %
                            [@attribute.name, @value, @attribute.valid_values.join(" ")])
end