Method: LinkedList::Conversions.Node
- Defined in:
- lib/linked-list/conversions.rb
.Node(arg) ⇒ Object
Node() tries to convert its argument to Node object by first calling #to_node, if that is not availabe then it will instantiate a new Node object.
Returns:
New Node object.
14 15 16 17 18 19 20 |
# File 'lib/linked-list/conversions.rb', line 14 def Node(arg) if arg.respond_to?(:to_node) arg.to_node else Node.new(arg) end end |