Class: Sexp

Inherits:
Object
  • Object
show all
Defined in:
lib/ruby_parser_extras.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#parenObject



1414
1415
1416
# File 'lib/ruby_parser_extras.rb', line 1414

def paren
  @paren ||= false
end

Instance Method Details

#add_all(x) ⇒ Object



1430
1431
1432
# File 'lib/ruby_parser_extras.rb', line 1430

def add_all x
  self.concat x.sexp_body
end

#block_pass?Boolean

Returns:

  • (Boolean)


1434
1435
1436
# File 'lib/ruby_parser_extras.rb', line 1434

def block_pass?
  any? { |s| Sexp === s && s[0] == :block_pass }
end

#to_symObject



1423
1424
1425
1426
# File 'lib/ruby_parser_extras.rb', line 1423

def to_sym
  raise "no: #{self.inspect}.to_sym is a bug"
  self.value.to_sym
end

#valueObject



1418
1419
1420
1421
# File 'lib/ruby_parser_extras.rb', line 1418

def value
  raise "multi item sexp" if size > 2
  last
end