Class: Fabulator::Expr::LetExpr
- Inherits:
-
Object
- Object
- Fabulator::Expr::LetExpr
- Defined in:
- lib/fabulator/expr/let_expr.rb
Instance Method Summary collapse
-
#initialize(dqname, expr) ⇒ LetExpr
constructor
A new instance of LetExpr.
- #run(context, autovivify = false) ⇒ Object
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 |