Class: SchemaEvolutionManager::MigrationFile::AttributeValue

Inherits:
Object
  • Object
show all
Defined in:
lib/schema-evolution-manager/migration_file.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attribute_name, value) ⇒ AttributeValue

Returns a new instance of AttributeValue.



26
27
28
29
30
31
32
33
34
35
36
37
38
39
# 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

Instance Attribute Details

#attributeObject (readonly)

Returns the value of attribute attribute.



24
25
26
# File 'lib/schema-evolution-manager/migration_file.rb', line 24

def attribute
  @attribute
end

#valueObject (readonly)

Returns the value of attribute value.



24
25
26
# File 'lib/schema-evolution-manager/migration_file.rb', line 24

def value
  @value
end