Class: Selector::Array
- Inherits:
-
Collection
- Object
- Condition
- Collection
- Selector::Array
- Defined in:
- lib/selector/array.rb
Overview
The condition checks if a value is included to the array
Instance Attribute Summary
Attributes inherited from Condition
Instance Method Summary collapse
-
#&(other) ⇒ Object
Creates an AND composition.
-
#initialize(array) ⇒ Array
constructor
A new instance of Array.
-
#|(other) ⇒ Object
Creates an OR composition.
Methods inherited from Collection
Methods inherited from Condition
#!, #-, #==, #[], #attribute
Constructor Details
#initialize(array) ⇒ Array
Returns a new instance of Array.
10 11 12 |
# File 'lib/selector/array.rb', line 10 def initialize(array) super Set.new(array) end |
Instance Method Details
#&(other) ⇒ Object
Creates an AND composition
If other value is a array, then creates modified array to avoid nesting
22 23 24 25 |
# File 'lib/selector/array.rb', line 22 def &(other) return super unless other.instance_of? self.class self.class.new attribute & other.attribute end |
#|(other) ⇒ Object
Creates an OR composition
If other value is a array, then creates modified array to avoid nesting
35 36 37 38 |
# File 'lib/selector/array.rb', line 35 def |(other) return super unless other.instance_of? self.class self.class.new attribute | other.attribute end |