class VersionOne::AttributeDefinition

Public Class Methods

new(xml) click to toggle source
# File lib/version-one/meta/attribute_definition.rb, line 5
def initialize(xml)
  @xml = xml
  @original_type = @xml.attributes['attributetype']
end

Public Instance Methods

attribute?() click to toggle source
# File lib/version-one/meta/attribute_definition.rb, line 34
def attribute?
  !relation?
end
inspect() click to toggle source
# File lib/version-one/meta/attribute_definition.rb, line 38
def inspect
  '#<AttributeDefinition:%s:%s>' % [self.name, @original_type]
end
multivalue?() click to toggle source
# File lib/version-one/meta/attribute_definition.rb, line 18
def multivalue?
  bool('ismultivalue')
end
name() click to toggle source
# File lib/version-one/meta/attribute_definition.rb, line 10
def name
  @name ||= @xml.attributes['name']
end
readonly?() click to toggle source
# File lib/version-one/meta/attribute_definition.rb, line 22
def readonly?
  bool('isreadonly')
end
relation?() click to toggle source
# File lib/version-one/meta/attribute_definition.rb, line 30
def relation?
  self.type == :relation
end
required?() click to toggle source
# File lib/version-one/meta/attribute_definition.rb, line 26
def required?
  bool('isrequired')
end
type() click to toggle source
# File lib/version-one/meta/attribute_definition.rb, line 14
def type
  @type ||= @original_type.downcase.to_sym
end

Private Instance Methods

bool(name) click to toggle source
# File lib/version-one/meta/attribute_definition.rb, line 44
def bool(name)
  @xml.attributes[name] == 'True'
end