default_strategy
default value will be'default'
, assuming amodel_namespace/default_strategy.rb
file withDefaultStrategy
classnew_with_default_strategy
class method (instantiating with'default'
strategy if not configured ordefault_strategy
class method value if configured)
- Generate
strategy_name
attribute onStrategic
class if it does not already exist like in the case of a Rails migration column - Automatically set
strategy_name
attribute when settingstrategy
attribute (eitherstrategy_name
attribute in Ruby or column in Rails) - Load
strategy
attribute fromstrategy_name
attribute onafter_initialize
in Rails
- Fix error "undefined method `new' for Strategic::Strategy:Module" that occurs when setting an empty string strategy (must return nil or default strategy)
- Fix issue with
ancestors
method not available on all constants (only ones that are classes/modules)
- Improve design to better match the authentic Gang of Four Strategy Pattern with
Strategic::Strategy
module, removing the need for inheritance. #strategy=
/#strategy
enable setting/getting strategy on model#context
enables getting strategic model instance on strategy just as per the GOF Design Patterndefault_strategy
class body method to set default strategy- Filter strategies by ones ending with
Strategy
in class name
strategy_name
returns parsed strategy name of current strategy classstrategy_matcher
ignores a strategy if it found another strategy already matching by strategy_alias
strategy_matcher
block support that enables any strategy to specify a custom matcher (or the superclass of all strategies instead)strategy_exclusion
class method support that enables any strategy to specify exclusions from the customstrategy_matcher
strategy_alias
class method support that enables any strategy to specify extra aliases (used by superclass'sstrategy_class_for
method)
- Initial version with
strategy_class_for
,new_strategy
,strategies
, andstrategy_names