Class: JPath::Parser::Operator
- Inherits:
-
Object
- Object
- JPath::Parser::Operator
- Defined in:
- lib/jpath/parser/formula.rb
Instance Attribute Summary collapse
-
#char ⇒ Object
readonly
Returns the value of attribute char.
-
#parts ⇒ Object
readonly
Returns the value of attribute parts.
Instance Method Summary collapse
- #+(other) ⇒ Object
- #add(other) ⇒ Object
- #boolean? ⇒ Boolean
-
#initialize(char) ⇒ Operator
constructor
A new instance of Operator.
- #to_s ⇒ Object
Constructor Details
#initialize(char) ⇒ Operator
Returns a new instance of Operator.
26 27 28 29 |
# File 'lib/jpath/parser/formula.rb', line 26 def initialize(char) @char = char @parts = [] end |
Instance Attribute Details
#char ⇒ Object (readonly)
Returns the value of attribute char.
22 23 24 |
# File 'lib/jpath/parser/formula.rb', line 22 def char @char end |
#parts ⇒ Object (readonly)
Returns the value of attribute parts.
24 25 26 |
# File 'lib/jpath/parser/formula.rb', line 24 def parts @parts end |
Instance Method Details
#+(other) ⇒ Object
35 36 37 |
# File 'lib/jpath/parser/formula.rb', line 35 def +(other) add(other) end |
#add(other) ⇒ Object
39 40 41 42 43 44 45 46 |
# File 'lib/jpath/parser/formula.rb', line 39 def add(other) @parts << other if parts.size < 2 self else Formula.new(char, parts) end end |
#boolean? ⇒ Boolean
31 32 33 |
# File 'lib/jpath/parser/formula.rb', line 31 def boolean? false end |
#to_s ⇒ Object
48 49 50 |
# File 'lib/jpath/parser/formula.rb', line 48 def to_s char.to_s end |