Class: Warg::Executor
- Inherits:
-
Object
- Object
- Warg::Executor
- Defined in:
- lib/warg.rb
Defined Under Namespace
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.
1571 1572 1573 |
# File 'lib/warg.rb', line 1571 def strategies @strategies end |
Instance Attribute Details
#collection ⇒ Object (readonly)
Returns the value of attribute collection.
1587 1588 1589 |
# File 'lib/warg.rb', line 1587 def collection @collection end |
#result ⇒ Object (readonly)
Returns the value of attribute result.
1588 1589 1590 |
# File 'lib/warg.rb', line 1588 def result @result end |
Class Method Details
.for(name) ⇒ Object
1576 1577 1578 |
# File 'lib/warg.rb', line 1576 def self.for(name) @strategies.fetch(name) end |
.register(name, &block) ⇒ Object
1580 1581 1582 1583 1584 1585 |
# 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 |
Instance Method Details
#in_order(&block) ⇒ Object
1601 1602 1603 |
# File 'lib/warg.rb', line 1601 def in_order(&block) raise NotImplementedError end |
#run(&block) ⇒ Object
FIXME: error handling?
1596 1597 1598 1599 |
# File 'lib/warg.rb', line 1596 def run(&block) in_order(&block) result end |