Method: Graph::NodeArray#push

Defined in:
lib/graph.rb

#push(n) ⇒ NodeArray

Add the given node at the end of the list

Parameters:

Returns:



152
153
154
155
156
157
158
159
160
# File 'lib/graph.rb', line 152

def push(n)
    if (!n.is_a?(Hash) && !n.is_a?(Node))
        raise TypeError.new "#{n.inspect} is not an Hash nor a Node!"
    end

    n = Node.new(n) if (n.is_a?(Hash))

    super(n.clone.update(@defaults))
end