Class: VersionOne::AttributeDefinition
- Inherits:
-
Object
- Object
- VersionOne::AttributeDefinition
- Defined in:
- lib/version-one/meta/attribute_definition.rb
Instance Method Summary collapse
- #attribute? ⇒ Boolean
-
#initialize(xml) ⇒ AttributeDefinition
constructor
A new instance of AttributeDefinition.
- #inspect ⇒ Object
- #multivalue? ⇒ Boolean
- #name ⇒ Object
- #readonly? ⇒ Boolean
- #relation? ⇒ Boolean
- #required? ⇒ Boolean
- #type ⇒ Object
Constructor Details
#initialize(xml) ⇒ AttributeDefinition
5 6 7 8 |
# File 'lib/version-one/meta/attribute_definition.rb', line 5 def initialize(xml) @xml = xml @original_type = @xml.attributes['attributetype'] end |
Instance Method Details
#attribute? ⇒ Boolean
34 35 36 |
# File 'lib/version-one/meta/attribute_definition.rb', line 34 def attribute? !relation? end |
#inspect ⇒ Object
38 39 40 |
# File 'lib/version-one/meta/attribute_definition.rb', line 38 def inspect '#<AttributeDefinition:%s:%s>' % [self.name, @original_type] end |
#multivalue? ⇒ Boolean
18 19 20 |
# File 'lib/version-one/meta/attribute_definition.rb', line 18 def multivalue? bool('ismultivalue') end |
#name ⇒ Object
10 11 12 |
# File 'lib/version-one/meta/attribute_definition.rb', line 10 def name @name ||= @xml.attributes['name'] end |
#readonly? ⇒ Boolean
22 23 24 |
# File 'lib/version-one/meta/attribute_definition.rb', line 22 def readonly? bool('isreadonly') end |
#relation? ⇒ Boolean
30 31 32 |
# File 'lib/version-one/meta/attribute_definition.rb', line 30 def relation? self.type == :relation end |
#required? ⇒ Boolean
26 27 28 |
# File 'lib/version-one/meta/attribute_definition.rb', line 26 def required? bool('isrequired') end |
#type ⇒ Object
14 15 16 |
# File 'lib/version-one/meta/attribute_definition.rb', line 14 def type @type ||= @original_type.downcase.to_sym end |