class ActiveSet::Sorting::Operation
Public Class Methods
new(set, instructions_hash)
click to toggle source
# File lib/active_set/sorting/operation.rb, line 10 def initialize(set, instructions_hash) @set = set @instructions_hash = instructions_hash end
Public Instance Methods
execute()
click to toggle source
# File lib/active_set/sorting/operation.rb, line 15 def execute attribute_instructions = @instructions_hash .flatten_keys .map { |k, v| AttributeInstruction.new(k, v) } activerecord_strategy = ActiveRecordStrategy.new(@set, attribute_instructions) if activerecord_strategy.executable_instructions == attribute_instructions activerecord_sorted_set = activerecord_strategy.execute end return activerecord_sorted_set if attribute_instructions.all?(&:processed?) EnumerableStrategy.new(@set, attribute_instructions).execute end
operation_instructions()
click to toggle source
# File lib/active_set/sorting/operation.rb, line 30 def operation_instructions @instructions_hash.symbolize_keys end