Class: ActiveSet::Filtering::Enumerable::Strategy
- Inherits:
-
Object
- Object
- ActiveSet::Filtering::Enumerable::Strategy
- Defined in:
- lib/active_set/filtering/enumerable/strategy.rb
Instance Method Summary collapse
- #execute ⇒ Object
-
#initialize(set, attribute_instruction) ⇒ Strategy
constructor
A new instance of Strategy.
Constructor Details
#initialize(set, attribute_instruction) ⇒ Strategy
Returns a new instance of Strategy.
20 21 22 23 24 |
# File 'lib/active_set/filtering/enumerable/strategy.rb', line 20 def initialize(set, attribute_instruction) @set = set @attribute_instruction = attribute_instruction @set_instruction = SetInstruction.new(attribute_instruction, set) end |
Instance Method Details
#execute ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/active_set/filtering/enumerable/strategy.rb', line 26 def execute return false unless @set.respond_to? :select if execute_filter_operation? set = filter_operation elsif execute_intersect_operation? begin set = intersect_operation rescue TypeError # thrown if intersecting with a non-Array return false end else return false end set end |