Class: Fabulator::Expr::LetExpr

Inherits:
Object
  • Object
show all
Defined in:
lib/fabulator/expr/let_expr.rb

Instance Method Summary collapse

Constructor Details

#initialize(dqname, expr) ⇒ LetExpr

Returns a new instance of LetExpr.



4
5
6
7
8
# File 'lib/fabulator/expr/let_expr.rb', line 4

def initialize(dqname, expr)
  @expr = expr
  dqname =~ /^\$?(.*)$/
  @name = $1
end

Instance Method Details

#run(context, autovivify = false) ⇒ Object



10
11
12
13
14
# File 'lib/fabulator/expr/let_expr.rb', line 10

def run(context, autovivify = false)
  result = @expr.run(context, autovivify)
  context.set_var(@name, result)
  return [ ]
end