Method: Configue::Node#initialize
- Defined in:
- lib/configue/node.rb
#initialize(object) ⇒ Node
Returns a new instance of Node.
7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/configue/node.rb', line 7 def initialize(object) raise TypeError unless object.respond_to?(:[]) if object.is_a? self.class node_type = object.instance_variable_get(:@node_type) end if object.is_a? Hash or node_type == :hash setup_as_hash_node(object) elsif object.is_a? Array or node_type == :array setup_as_array_node(object) end self end |