Class: Yuriita::Executor

Inherits:
Object
  • Object
show all
Defined in:
lib/yuriita/executor.rb

Instance Method Summary collapse

Constructor Details

#initialize(clauses) ⇒ Executor

Returns a new instance of Executor.



3
4
5
# File 'lib/yuriita/executor.rb', line 3

def initialize(clauses)
  @clauses = clauses
end

Instance Method Details

#run(relation) ⇒ Object



7
8
9
10
11
# File 'lib/yuriita/executor.rb', line 7

def run(relation)
  clauses.reduce(relation) do |chain, clause|
    chain.merge(clause.apply(relation))
  end
end