class ActiveSet

Attributes

configuration[W]
instructions[R]
set[R]
view[R]

Public Class Methods

configuration() click to toggle source
# File lib/active_set.rb, line 26
def self.configuration
  @configuration ||= Configuration.new
end
configure() { |configuration| ... } click to toggle source
# File lib/active_set.rb, line 30
def self.configure
  yield(configuration)
end
new(set, view: nil, instructions: {}) click to toggle source
# File lib/active_set.rb, line 40
def initialize(set, view: nil, instructions: {})
  @set = set
  @view = view || set
  @instructions = instructions
end
reset_configuration() click to toggle source
# File lib/active_set.rb, line 34
def self.reset_configuration
  @configuration = Configuration.new
end

Public Instance Methods

==(other) click to toggle source
# File lib/active_set.rb, line 55
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 46
def each(&block)
  @view.each(&block)
end
export(instructions_hash) click to toggle source
# File lib/active_set.rb, line 87
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 72
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 51
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 61
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 82
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 67
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 77
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 94
def reinitialize(processed_set, method, instructions)
  self.class.new(@set,
                 view: processed_set,
                 instructions: @instructions.merge(
                   method => instructions
                 ))
end