Class: SchemaEvolutionManager::MigrationFile::AttributeValue
- Inherits:
-
Object
- Object
- SchemaEvolutionManager::MigrationFile::AttributeValue
- Defined in:
- lib/schema-evolution-manager/migration_file.rb
Instance Attribute Summary collapse
-
#attribute ⇒ Object
readonly
Returns the value of attribute attribute.
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Instance Method Summary collapse
-
#initialize(attribute_name, value) ⇒ AttributeValue
constructor
A new instance of AttributeValue.
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
#attribute ⇒ Object (readonly)
Returns the value of attribute attribute.
24 25 26 |
# File 'lib/schema-evolution-manager/migration_file.rb', line 24 def attribute @attribute end |
#value ⇒ Object (readonly)
Returns the value of attribute value.
24 25 26 |
# File 'lib/schema-evolution-manager/migration_file.rb', line 24 def value @value end |