Class: Panda::Comparison
- Inherits:
-
Expression
- Object
- Node
- Expression
- Panda::Comparison
- Defined in:
- lib/panda/expressions.rb
Overview
The binary comparison expression node class.
Comparison expressions consist of a Panda::Subject object as the left operand (the ‘subject’ of a comparison) and any type of object as the right operand (the ‘object’ of a comparison).
The possible operators are:
-
:== (is)
-
:not
-
:< (less_than)
-
:<= (less_than_or_equal_to)
-
:> (greater_than)
-
:>= (greater_than_or_equal_to)
-
:=~ (matches_regexp)
-
:like
-
:ilike
- NOTE:
-
It is not possible in ruby 1.8 to overload the != operator so you’ll have to call it by name (:not) :P.
Instance Attribute Summary
Attributes inherited from Expression
Instance Method Summary collapse
-
#initialize(subject, operator, object) ⇒ Comparison
constructor
Same precondition as Panda::Expression plus a Panda::SyntaxError is raised if subject is not an instance of Panda::Subject.
Methods inherited from Expression
#has_operator?, has_operator?, #inspect, inspector=, #operator_alias, operator_alias_for, operators
Methods inherited from Node
Constructor Details
#initialize(subject, operator, object) ⇒ Comparison
Same precondition as Panda::Expression plus a Panda::SyntaxError is raised if subject is not an instance of Panda::Subject.
177 178 179 180 181 182 |
# File 'lib/panda/expressions.rb', line 177 def initialize(subject, operator, object) unless subject.kind_of?(Subject) raise SyntaxError, "Bad subject for #{self.class}: expected an instance of Panda::Subject but got #{subject.inspect}" end super end |