lib/oehclient/data/node.rb in oeh-client-0.2.3 vs lib/oehclient/data/node.rb in oeh-client-0.2.4

- old
+ new

@@ -16,10 +16,19 @@ (value.kind_of?(Array) ? add_collection(key, value) : add_attribute(key, value)) end end + # return the names of each of the attributes of the current nodes of the structure + def attribute_names() + name_collection = Array.new + instance_variable_names.each { | structure_attribute | name_collection << structure_attribute.slice!(0)} + + name_collection + end # def attribute_names + + private # add_collection dynamically create an attr_accessor as an array of Oeh::Structure::Node # classes related to the current instance of the object. def add_collection(name, value_collection) @@ -47,9 +56,9 @@ # create the accessor in the current class and set the value based on the type # of object that represents the value self.class.send(:attr_accessor, accessor_name) instance_variable_set("@#{accessor_name}", (value.kind_of?(Hash) ? OEHClient::Data::Node.new(value) : value)) - end + end end \ No newline at end of file