Sha256: 66cb9bc71c42f9d8dff6c470355233a4aed89cadd56c1c88dc0725e8ad1d5433
Contents?: true
Size: 557 Bytes
Versions: 4
Compression:
Stored size: 557 Bytes
Contents
# encoding: utf-8 # Include this module to strategy superclass module Rango module StrategyMixin class << self attribute :strategies, Array.new def register self.strategies.push(self) end def find(*args) self.strategies.find { |strategy| strategy.match?(*args) } end end def match?(*args) raise "This method must be redefined in subclasses" end def run(*args) raise "This method must be redefined in subclasses" end # define setup method if you need it end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
rango-0.1.0 | lib/rango/mixins/strategy.rb |
rango-0.0.6 | lib/rango/mixins/strategy.rb |
rango-0.1.pre | lib/rango/mixins/strategy.rb |
rango-0.0.4 | lib/rango/mixins/strategy.rb |