Class: Configue::Node
- Inherits:
-
Object
- Object
- Configue::Node
- Defined in:
- lib/configue/node.rb
Direct Known Subclasses
Instance Method Summary collapse
-
#initialize(object) ⇒ Node
constructor
A new instance of Node.
Constructor Details
#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 |