Class: Squeel::Nodes::Nary
- Inherits:
-
Object
- Object
- Squeel::Nodes::Nary
- Includes:
- PredicateOperators
- Defined in:
- lib/squeel/nodes/nary.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#children ⇒ Object
readonly
Returns the value of attribute children.
Instance Method Summary collapse
- #&(other) ⇒ Object
- #-(other) ⇒ Object
- #eql?(other) ⇒ Boolean (also: #==)
-
#initialize(children) ⇒ Nary
constructor
A new instance of Nary.
Methods included from PredicateOperators
Constructor Details
#initialize(children) ⇒ Nary
Returns a new instance of Nary.
8 9 10 11 12 13 14 |
# File 'lib/squeel/nodes/nary.rb', line 8 def initialize(children) raise ArgumentError, '#{self.class} requires an array' unless Array === children # We don't dup here, as incoming arrays should be created by the # Operators#& method on other nodes. If you're creating And nodes # manually, by sure that they're new arays. @children = children end |
Instance Attribute Details
#children ⇒ Object (readonly)
Returns the value of attribute children.
6 7 8 |
# File 'lib/squeel/nodes/nary.rb', line 6 def children @children end |
Instance Method Details
#&(other) ⇒ Object
16 17 18 19 |
# File 'lib/squeel/nodes/nary.rb', line 16 def &(other) @children << other self end |
#-(other) ⇒ Object
21 22 23 24 |
# File 'lib/squeel/nodes/nary.rb', line 21 def -(other) @children << Not.new(other) self end |
#eql?(other) ⇒ Boolean Also known as: ==
26 27 28 29 |
# File 'lib/squeel/nodes/nary.rb', line 26 def eql?(other) self.class == other.class && self.children == other.children end |