Class: OEHClient::Data::Node
- Inherits:
-
Object
- Object
- OEHClient::Data::Node
- Defined in:
- lib/oehclient/data/node.rb
Direct Known Subclasses
Structure, Meta::Interaction, Meta::Touchpoint, Meta::Workspace
Instance Attribute Summary collapse
-
#nodes ⇒ Object
Returns the value of attribute nodes.
Instance Method Summary collapse
-
#attribute_names ⇒ Object
return the names of each of the attributes of the current nodes of the structure.
-
#initialize(data) ⇒ Node
constructor
A new instance of Node.
Constructor Details
permalink #initialize(data) ⇒ Node
Returns a new instance of Node.
6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/oehclient/data/node.rb', line 6 def initialize(data) # Raise an exception if the data passed is not already a hash # based on the type of object that is passed, create the proper attribute accessor # to allow easy access to data. For example, a simple value in the structure called # firstName will be represented in the object as my_structure.first_name. Simple # object are represented as related node classes. For example a Preference node with # an attribute of nonSmokingRoom will be represented as my_structure.preference.non_smoking_room data.each do | key, value | (value.kind_of?(Array) ? add_collection(key, value) : add_attribute(key, value)) end end |
Instance Attribute Details
permalink #nodes ⇒ Object
Returns the value of attribute nodes.
4 5 6 |
# File 'lib/oehclient/data/node.rb', line 4 def nodes @nodes end |
Instance Method Details
permalink #attribute_names ⇒ Object
return the names of each of the attributes of the current nodes of the structure
22 23 24 25 26 27 28 29 |
# File 'lib/oehclient/data/node.rb', line 22 def attribute_names() name_collection = Array.new instance_variable_names.each do | structure_attribute | structure_attribute.slice!(0) name_collection << structure_attribute end name_collection end |