Class: BBSexp::Expression
- Inherits:
-
Object
- Object
- BBSexp::Expression
- Includes:
- Comparable
- Defined in:
- lib/bbsexp/expression.rb
Instance Attribute Summary collapse
-
#block ⇒ Object
readonly
Returns the value of attribute block.
-
#state ⇒ Object
readonly
Returns the value of attribute state.
-
#sym ⇒ Object
readonly
Returns the value of attribute sym.
-
#tags ⇒ Object
readonly
Returns the value of attribute tags.
Instance Method Summary collapse
- #<=>(b) ⇒ Object
-
#initialize(sym, state, args = {}) ⇒ Expression
constructor
A new instance of Expression.
Constructor Details
#initialize(sym, state, args = {}) ⇒ Expression
Returns a new instance of Expression.
6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/bbsexp/expression.rb', line 6 def initialize(sym, state, args={}) @sym = sym @state = case state when :block then 3 when :inline then 2 when :func then 1 when :noparse then 0 else state end = args[:tags] || ['', ''] @block = args[:func] end |
Instance Attribute Details
#block ⇒ Object (readonly)
Returns the value of attribute block.
4 5 6 |
# File 'lib/bbsexp/expression.rb', line 4 def block @block end |
#state ⇒ Object (readonly)
Returns the value of attribute state.
4 5 6 |
# File 'lib/bbsexp/expression.rb', line 4 def state @state end |
#sym ⇒ Object (readonly)
Returns the value of attribute sym.
4 5 6 |
# File 'lib/bbsexp/expression.rb', line 4 def sym @sym end |
#tags ⇒ Object (readonly)
Returns the value of attribute tags.
4 5 6 |
# File 'lib/bbsexp/expression.rb', line 4 def end |
Instance Method Details
#<=>(b) ⇒ Object
19 20 21 |
# File 'lib/bbsexp/expression.rb', line 19 def <=>(b) @state <=> (b.class == Expression ? b.state : b.to_i) end |