class Warg::Executor

Attributes

strategies[R]
collection[R]
result[R]

Public Class Methods

for(name) click to toggle source
# File lib/warg.rb, line 1576
def self.for(name)
  @strategies.fetch(name)
end
new(collection) click to toggle source
# File lib/warg.rb, line 1590
def initialize(collection)
  @collection = collection
  @result = Result.new
end
register(name, &block) click to toggle source
# File lib/warg.rb, line 1580
def self.register(name, &block)
  strategy = Class.new(self)
  strategy.send(:define_method, :in_order, &block)

  @strategies[name] = strategy
end

Public Instance Methods

in_order(&block) click to toggle source
# File lib/warg.rb, line 1601
def in_order(&block)
  raise NotImplementedError
end
run(&block) click to toggle source

FIXME: error handling?

# File lib/warg.rb, line 1596
def run(&block)
  in_order(&block)
  result
end