Class: Fabulator::Expr::Literal
- Inherits:
-
Object
- Object
- Fabulator::Expr::Literal
- Defined in:
- lib/fabulator/expr/literal.rb
Instance Method Summary collapse
- #expr_type(context) ⇒ Object
-
#initialize(e, t = nil) ⇒ Literal
constructor
A new instance of Literal.
- #run(context, autovivify = false) ⇒ Object
Constructor Details
#initialize(e, t = nil) ⇒ Literal
Returns a new instance of Literal.
4 5 6 7 |
# File 'lib/fabulator/expr/literal.rb', line 4 def initialize(e, t = nil) @lit = e @type = t end |
Instance Method Details
#expr_type(context) ⇒ Object
9 10 11 |
# File 'lib/fabulator/expr/literal.rb', line 9 def expr_type(context) @type end |
#run(context, autovivify = false) ⇒ Object
13 14 15 |
# File 'lib/fabulator/expr/literal.rb', line 13 def run(context, autovivify = false) return [ context.root.anon_node(@lit, @type) ] end |