class ActiveSet

Attributes

instructions[R]
set[R]
view[R]

Public Class Methods

new(set, view: nil, instructions: {}) click to toggle source
# File lib/active_set.rb, line 17
def initialize(set, view: nil, instructions: {})
  @set = set
  @view = view || set
  @instructions = instructions
end

Public Instance Methods

==(other) click to toggle source
# File lib/active_set.rb, line 32
def ==(other)
  return @view == other unless other.is_a?(ActiveSet)

  @view == other.view
end
each(&block) click to toggle source
# File lib/active_set.rb, line 23
def each(&block)
  @view.each(&block)
end
export(instructions_hash) click to toggle source
# File lib/active_set.rb, line 64
def export(instructions_hash)
  exporter = Exporting::Operation.new(@view, instructions_hash)
  exporter.execute
end
filter(instructions_hash) click to toggle source

:nocov:

# File lib/active_set.rb, line 49
def filter(instructions_hash)
  filterer = Filtering::Operation.new(@view, instructions_hash)
  reinitialize(filterer.execute, :filter, filterer.operation_instructions)
end
inspect() click to toggle source

:nocov:

# File lib/active_set.rb, line 28
def inspect
  "#<ActiveSet:#{object_id} @instructions=#{@instructions.inspect}>"
end
method_missing(method_name, *args, &block) click to toggle source
Calls superclass method
# File lib/active_set.rb, line 38
def method_missing(method_name, *args, &block)
  return @view.send(method_name, *args, &block) if @view.respond_to?(method_name)

  super
end
paginate(instructions_hash) click to toggle source
# File lib/active_set.rb, line 59
def paginate(instructions_hash)
  paginater = Paginating::Operation.new(@view, instructions_hash)
  reinitialize(paginater.execute, :paginate, paginater.operation_instructions)
end
respond_to_missing?(method_name, include_private = false) click to toggle source
Calls superclass method
# File lib/active_set.rb, line 44
def respond_to_missing?(method_name, include_private = false)
  @view.respond_to?(method_name) || super
end
sort(instructions_hash) click to toggle source
# File lib/active_set.rb, line 54
def sort(instructions_hash)
  sorter = Sorting::Operation.new(@view, instructions_hash)
  reinitialize(sorter.execute, :sort, sorter.operation_instructions)
end

Private Instance Methods

reinitialize(processed_set, method, instructions) click to toggle source
# File lib/active_set.rb, line 71
def reinitialize(processed_set, method, instructions)
  self.class.new(@set,
                 view: processed_set,
                 instructions: @instructions.merge(
                   method => instructions
                 ))
end