class RedParse::ListInNode::ArrayLiteralNode

Public Class Methods

new(lbrack,contents,rbrack) click to toggle source
Calls superclass method RedParse::ListInNode::Node::new
# File lib/redparse/node.rb, line 4235
def initialize(lbrack,contents,rbrack)
  @offset=lbrack.offset
  contents or return super()
  if CommaOpNode===contents
    h,arrowrange=contents.extract_unbraced_hash
    contents[arrowrange]=[h] if arrowrange
    super( *contents )
  elsif ArrowOpNode===contents
    h=HashLiteralNode.new(nil,contents,nil)
    h.startline=contents.startline
    h.endline=contents.endline
    super HashLiteralNode.new(nil,contents,nil)
  else
    super contents
  end
end

Public Instance Methods

image() click to toggle source
# File lib/redparse/node.rb, line 4252
def image; "([])" end
parsetree(o) click to toggle source
# File lib/redparse/node.rb, line 4258
def parsetree(o)
  size.zero? and return [:zarray]
  normals,star=param_list_parse(self,o)
  result=normals.unshift :array
  if star
    if size==1
      result=star
    else
      result=[:argscat, result, star.last] 
    end
  end
  result
end
unparse(o=default_unparse_options) click to toggle source
# File lib/redparse/node.rb, line 4254
def unparse o=default_unparse_options
  "["+map{|item| unparse_nl(item,o,'')+item.unparse_maybe_parens(o)}.join(', ')+"]"
end