Class: Liquid2::Parameter
- Inherits:
-
Expression
- Object
- Expression
- Liquid2::Parameter
- Defined in:
- lib/liquid2/expressions/arguments.rb
Overview
A macro parameter with a name and optional default value.
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#sym ⇒ Object
readonly
Returns the value of attribute sym.
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Attributes inherited from Expression
Instance Method Summary collapse
- #children ⇒ Object
- #evaluate(context) ⇒ Object
-
#initialize(token, name, value) ⇒ Parameter
constructor
A new instance of Parameter.
Methods inherited from Expression
Constructor Details
#initialize(token, name, value) ⇒ Parameter
Returns a new instance of Parameter.
32 33 34 35 36 37 |
# File 'lib/liquid2/expressions/arguments.rb', line 32 def initialize(token, name, value) super(token) @name = name @sym = name.to_sym @value = value end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
28 29 30 |
# File 'lib/liquid2/expressions/arguments.rb', line 28 def name @name end |
#sym ⇒ Object (readonly)
Returns the value of attribute sym.
28 29 30 |
# File 'lib/liquid2/expressions/arguments.rb', line 28 def sym @sym end |
#value ⇒ Object (readonly)
Returns the value of attribute value.
28 29 30 |
# File 'lib/liquid2/expressions/arguments.rb', line 28 def value @value end |
Instance Method Details
#children ⇒ Object
43 |
# File 'lib/liquid2/expressions/arguments.rb', line 43 def children = [@value] |
#evaluate(context) ⇒ Object
39 40 41 |
# File 'lib/liquid2/expressions/arguments.rb', line 39 def evaluate(context) [@name, context.evaluate(@value)] end |