Module: RubyExts::StrategyMixin
- Defined in:
- lib/rubyexts/mixins/strategy.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.find(*args) ⇒ Object
13 14 15 |
# File 'lib/rubyexts/mixins/strategy.rb', line 13 def find(*args) self.strategies.find { |strategy| strategy.match?(*args) } end |
.register ⇒ Object
9 10 11 |
# File 'lib/rubyexts/mixins/strategy.rb', line 9 def register self.strategies.push(self) end |
Instance Method Details
#match?(*args) ⇒ Boolean
18 19 20 |
# File 'lib/rubyexts/mixins/strategy.rb', line 18 def match?(*args) raise "This method must be redefined in subclasses" end |
#run(*args) ⇒ Object
22 23 24 |
# File 'lib/rubyexts/mixins/strategy.rb', line 22 def run(*args) raise "This method must be redefined in subclasses" end |