Class: Rack::CoreData::DataModel::Attribute
- Inherits:
-
Object
- Object
- Rack::CoreData::DataModel::Attribute
- Defined in:
- lib/rack/core-data/data_model/attribute.rb
Instance Attribute Summary collapse
-
#default_value ⇒ Object
readonly
Returns the value of attribute default_value.
-
#identifier ⇒ Object
readonly
Returns the value of attribute identifier.
-
#maximum_value ⇒ Object
readonly
Returns the value of attribute maximum_value.
-
#minimum_value ⇒ Object
readonly
Returns the value of attribute minimum_value.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#regular_expression ⇒ Object
readonly
Returns the value of attribute regular_expression.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
-
#version_hash_modifier ⇒ Object
readonly
Returns the value of attribute version_hash_modifier.
Instance Method Summary collapse
-
#initialize(attribute) ⇒ Attribute
constructor
A new instance of Attribute.
- #to_s ⇒ Object
Constructor Details
#initialize(attribute) ⇒ Attribute
Returns a new instance of Attribute.
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/rack/core-data/data_model/attribute.rb', line 5 def initialize(attribute) raise ArgumentError unless ::Nokogiri::XML::Element === attribute @name = attribute['name'] @type = attribute['attributeType'] @identifier = attribute['elementID'] @version_hash_modifier = attribute['versionHashModifier'] @default_value = default_value_from_string(attribute['defaultValueString']) @minimum_value = range_value_from_string(attribute['minValueString']) @maximum_value = range_value_from_string(attribute['maxValueString']) @regular_expression = Regexp.new(attributes['regularExpressionString']) rescue nil @optional = attribute['optional'] == "YES" @transient = attribute['transient'] == "YES" @indexed = attribute['indexed'] == "YES" @syncable = attribute['syncable'] == "YES" end |
Instance Attribute Details
#default_value ⇒ Object (readonly)
Returns the value of attribute default_value.
3 4 5 |
# File 'lib/rack/core-data/data_model/attribute.rb', line 3 def default_value @default_value end |
#identifier ⇒ Object (readonly)
Returns the value of attribute identifier.
3 4 5 |
# File 'lib/rack/core-data/data_model/attribute.rb', line 3 def identifier @identifier end |
#maximum_value ⇒ Object (readonly)
Returns the value of attribute maximum_value.
3 4 5 |
# File 'lib/rack/core-data/data_model/attribute.rb', line 3 def maximum_value @maximum_value end |
#minimum_value ⇒ Object (readonly)
Returns the value of attribute minimum_value.
3 4 5 |
# File 'lib/rack/core-data/data_model/attribute.rb', line 3 def minimum_value @minimum_value end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
3 4 5 |
# File 'lib/rack/core-data/data_model/attribute.rb', line 3 def name @name end |
#regular_expression ⇒ Object (readonly)
Returns the value of attribute regular_expression.
3 4 5 |
# File 'lib/rack/core-data/data_model/attribute.rb', line 3 def regular_expression @regular_expression end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
3 4 5 |
# File 'lib/rack/core-data/data_model/attribute.rb', line 3 def type @type end |
#version_hash_modifier ⇒ Object (readonly)
Returns the value of attribute version_hash_modifier.
3 4 5 |
# File 'lib/rack/core-data/data_model/attribute.rb', line 3 def version_hash_modifier @version_hash_modifier end |
Instance Method Details
#to_s ⇒ Object
25 26 27 |
# File 'lib/rack/core-data/data_model/attribute.rb', line 25 def to_s [@name, @type].to_s end |