rlibs/chassis.rb
def convert_args_node(node)
    if node.kind_of?(String) || node.kind_of?(Symbol) || node.kind_of?(Numeric) || 
       node.kind_of?(TrueClass) || node.kind_of?(FalseClass) || node.kind_of?(NilClass)
      node
    elsif node.instance_of?(Array)
      if node[0] == :struct
        node[1].inject(HashWithIndifferentAccess.new) do |acc, x|
          acc[x[0]] = convert_args_node(x[1]); acc
        end
      elsif node[0] == :array
        node[1].inject([]) do |acc, x|
          acc << convert_args_node(x)
        end
      else
        raise "Invalid tagged node: #{node.inspect}"
      end
    else
      raise "Invalid node, must be an instance of String, Symbol, Numeric, True, False, Nil, or Array: #{node.inspect} (#{node.class.inspect})"
    end
  end
# Helper for +convert_args+. Recursively converts a node in
# Erlang-style to a node in Ruby-style
#  +node+ is the Erlang-style node
#
# Returns String|Symbol|Hash|Array
# Raises if an invalid node is encountered


Returns String|Symbol|Hash|Array
Raises if an invalid node is encountered
Returns String|Symbol|Hash|Array Raises if an invalid node is encountered
def convert_args_node(node)
    if node.kind_of?(String) || node.kind_of?(Symbol) || node.kind_of?(Numeric) || 
       node.kind_of?(TrueClass) || node.kind_of?(FalseClass) || node.kind_of?(NilClass)
      node
    elsif node.instance_of?(Array)
      if node[0] == :struct
        node[1].inject(HashWithIndifferentAccess.new) do |acc, x|
          acc[x[0]] = convert_args_node(x[1]); acc
        end
      elsif node[0] == :array
        node[1].inject([]) do |acc, x|
          acc << convert_args_node(x)
        end
      else
        raise "Invalid tagged node: #{node.inspect}"
      end
    else
      raise "Invalid node, must be an instance of String, Symbol, Numeric, True, False, Nil, or Array: #{node.inspect} (#{node.class.inspect})"
    end
  end
def convert_args_node ( node ) if node . kind_of? ( String ) || node . kind_of? ( Symbol ) || node . kind_of? ( Numeric ) || node . kind_of? ( TrueClass ) || node . kind_of? ( FalseClass ) || node . kind_of? ( NilClass ) node elsif node . instance_of? ( Array ) if node [ 0 ] == :struct node [ 1 ] . inject ( HashWithIndifferentAccess . new ) do | acc , x | acc [ x [ 0 ] ] = convert_args_node ( x [ 1 ] ) ; acc end elsif node [ 0 ] == :array node [ 1 ] . inject ( [ ] ) do | acc , x | acc << convert_args_node ( x ) end else raise "Invalid tagged node: #{node.inspect}" end else raise "Invalid node, must be an instance of String, Symbol, Numeric, True, False, Nil, or Array: #{node.inspect} (#{node.class.inspect})" end end
Helper for +convert_args+.
Helper for + convert_args + .
node