Class: Warg::Executor
- Inherits:
-
Object
- Object
- Warg::Executor
- Defined in:
- lib/warg.rb
Defined Under Namespace
Classes: Result
Class Attribute Summary collapse
-
.strategies ⇒ Object
readonly
Returns the value of attribute strategies.
Instance Attribute Summary collapse
-
#collection ⇒ Object
readonly
Returns the value of attribute collection.
-
#result ⇒ Object
readonly
Returns the value of attribute result.
Class Method Summary collapse
Instance Method Summary collapse
- #in_order(&block) ⇒ Object
-
#initialize(collection) ⇒ Executor
constructor
A new instance of Executor.
-
#run(&block) ⇒ Object
FIXME: error handling?.
Constructor Details
Class Attribute Details
.strategies ⇒ Object (readonly)
Returns the value of attribute strategies.
1651 1652 1653 |
# File 'lib/warg.rb', line 1651 def strategies @strategies end |
Instance Attribute Details
#collection ⇒ Object (readonly)
Returns the value of attribute collection.
1667 1668 1669 |
# File 'lib/warg.rb', line 1667 def collection @collection end |
#result ⇒ Object (readonly)
Returns the value of attribute result.
1668 1669 1670 |
# File 'lib/warg.rb', line 1668 def result @result end |
Class Method Details
.for(name) ⇒ Object
1656 1657 1658 |
# File 'lib/warg.rb', line 1656 def self.for(name) @strategies.fetch(name) end |
.register(name, &block) ⇒ Object
1660 1661 1662 1663 1664 1665 |
# File 'lib/warg.rb', line 1660 def self.register(name, &block) strategy = Class.new(self) strategy.send(:define_method, :in_order, &block) @strategies[name] = strategy end |
Instance Method Details
#in_order(&block) ⇒ Object
1681 1682 1683 |
# File 'lib/warg.rb', line 1681 def in_order(&block) raise NotImplementedError end |
#run(&block) ⇒ Object
FIXME: error handling?
1676 1677 1678 1679 |
# File 'lib/warg.rb', line 1676 def run(&block) in_order(&block) result end |