Class: YACCL::Model::PropertyDefinition

Inherits:
Object
  • Object
show all
Defined in:
lib/yaccl/model/property_definition.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(hash = {}) ⇒ PropertyDefinition

Returns a new instance of PropertyDefinition.



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/yaccl/model/property_definition.rb', line 10

def initialize(hash={})
  @id = hash.delete(:id)
  @local_name = hash.delete(:localName)
  @query_name = hash.delete(:queryName)
  @description = hash.delete(:description)
  @inherited = hash.delete(:inherited)
  @open_choice = hash.delete(:openChoice)
  @orderable = hash.delete(:orderable)
  @property_type = hash.delete(:propertyType)
  @updatability = hash.delete(:updatability)
  @display_name = hash.delete(:displayName)
  @required = hash.delete(:required)
  @cardinality = hash.delete(:cardinality)
  @queryable = hash.delete(:queryable)
  @other = hash
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(m, *args, &block) ⇒ Object



39
40
41
42
43
44
45
# File 'lib/yaccl/model/property_definition.rb', line 39

def method_missing(m, *args, &block)
  if @other.has_key?(m)
    @other[m]
  else
    super
  end
end

Instance Attribute Details

#cardinalityObject

Returns the value of attribute cardinality.



5
6
7
# File 'lib/yaccl/model/property_definition.rb', line 5

def cardinality
  @cardinality
end

#descriptionObject

Returns the value of attribute description.



5
6
7
# File 'lib/yaccl/model/property_definition.rb', line 5

def description
  @description
end

#display_nameObject

Returns the value of attribute display_name.



5
6
7
# File 'lib/yaccl/model/property_definition.rb', line 5

def display_name
  @display_name
end

#idObject

Returns the value of attribute id.



5
6
7
# File 'lib/yaccl/model/property_definition.rb', line 5

def id
  @id
end

#inheritedObject

Returns the value of attribute inherited.



5
6
7
# File 'lib/yaccl/model/property_definition.rb', line 5

def inherited
  @inherited
end

#local_nameObject

Returns the value of attribute local_name.



5
6
7
# File 'lib/yaccl/model/property_definition.rb', line 5

def local_name
  @local_name
end

#open_choiceObject

Returns the value of attribute open_choice.



5
6
7
# File 'lib/yaccl/model/property_definition.rb', line 5

def open_choice
  @open_choice
end

#orderableObject

Returns the value of attribute orderable.



5
6
7
# File 'lib/yaccl/model/property_definition.rb', line 5

def orderable
  @orderable
end

#otherObject

Returns the value of attribute other.



5
6
7
# File 'lib/yaccl/model/property_definition.rb', line 5

def other
  @other
end

#property_typeObject

Returns the value of attribute property_type.



5
6
7
# File 'lib/yaccl/model/property_definition.rb', line 5

def property_type
  @property_type
end

#query_nameObject

Returns the value of attribute query_name.



5
6
7
# File 'lib/yaccl/model/property_definition.rb', line 5

def query_name
  @query_name
end

#queryableObject

Returns the value of attribute queryable.



5
6
7
# File 'lib/yaccl/model/property_definition.rb', line 5

def queryable
  @queryable
end

#requiredObject

Returns the value of attribute required.



5
6
7
# File 'lib/yaccl/model/property_definition.rb', line 5

def required
  @required
end

#updatabilityObject

Returns the value of attribute updatability.



5
6
7
# File 'lib/yaccl/model/property_definition.rb', line 5

def updatability
  @updatability
end

Instance Method Details

#oncreate?Boolean

Returns:

  • (Boolean)


31
32
33
# File 'lib/yaccl/model/property_definition.rb', line 31

def oncreate?
  updatability == 'oncreate'
end

#readonly?Boolean

Returns:

  • (Boolean)


27
28
29
# File 'lib/yaccl/model/property_definition.rb', line 27

def readonly?
  updatability == 'readonly'
end

#readwrite?Boolean

Returns:

  • (Boolean)


35
36
37
# File 'lib/yaccl/model/property_definition.rb', line 35

def readwrite?
  updatability == 'readwrite'
end

#to_hashObject



47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
# File 'lib/yaccl/model/property_definition.rb', line 47

def to_hash
  hash = {}
  hash[:id] = id
  hash[:localName] = local_name
  hash[:queryName] = query_name
  hash[:description] = description
  hash[:inherited] = inherited
  hash[:openChoice] = open_choice
  hash[:orderable] = orderable
  hash[:propertyType] = property_type
  hash[:updatability] = updatability
  hash[:displayName] = display_name
  hash[:required] = required
  hash[:cardinality] = cardinality
  hash[:queryable] = queryable
  hash.merge(other)
end