Class: Sexpir::When

Inherits:
Ast
  • Object
show all
Defined in:
lib/sexpir/ast.rb,
lib/sexpir/ast_sexp.rb

Instance Attribute Summary collapse

Attributes inherited from Ast

#node

Instance Method Summary collapse

Methods inherited from Ast

#accept

Instance Attribute Details

#bodyObject

Returns the value of attribute body.



80
81
82
# File 'lib/sexpir/ast.rb', line 80

def body
  @body
end

#exprObject

Returns the value of attribute expr.



80
81
82
# File 'lib/sexpir/ast.rb', line 80

def expr
  @expr
end

Instance Method Details

#sexpObject



149
150
151
152
153
154
155
156
157
# File 'lib/sexpir/ast_sexp.rb', line 149

def sexp
  code=Code.new
  code << "(when #{expr.sexp}"
  code.indent=2
  code << body.sexp
  code.indent=0
  code << ")"
  code
end