Class: Trebuchet::Strategy::LogicBase
- Defined in:
- lib/trebuchet/strategy/logic_base.rb
Instance Attribute Summary collapse
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#strategies ⇒ Object
readonly
Returns the value of attribute strategies.
Attributes inherited from Base
Instance Method Summary collapse
-
#feature=(f) ⇒ Object
Override feature setter so that @feature gets set on @strategies as well.
-
#initialize(options = {}) ⇒ LogicBase
constructor
A new instance of LogicBase.
- #launch_at?(user, request = nil) ⇒ Boolean
- #needs_user? ⇒ Boolean
Methods inherited from Base
#as_json, #export, #feature_id, #inspect, #name, strategy_name
Constructor Details
#initialize(options = {}) ⇒ LogicBase
Returns a new instance of LogicBase.
6 7 8 9 10 11 12 |
# File 'lib/trebuchet/strategy/logic_base.rb', line 6 def initialize( = {}) = @strategies = [] .each do |strategy_name, | @strategies << Trebuchet::Strategy.find(strategy_name.to_sym, ) end end |
Instance Attribute Details
#options ⇒ Object (readonly)
Returns the value of attribute options.
4 5 6 |
# File 'lib/trebuchet/strategy/logic_base.rb', line 4 def end |
#strategies ⇒ Object (readonly)
Returns the value of attribute strategies.
3 4 5 |
# File 'lib/trebuchet/strategy/logic_base.rb', line 3 def strategies @strategies end |
Instance Method Details
#feature=(f) ⇒ Object
Override feature setter so that @feature gets set on @strategies as well
15 16 17 18 |
# File 'lib/trebuchet/strategy/logic_base.rb', line 15 def feature=(f) @feature = f @strategies.each { |s| s.feature = f } end |
#launch_at?(user, request = nil) ⇒ Boolean
20 21 22 |
# File 'lib/trebuchet/strategy/logic_base.rb', line 20 def launch_at?(user, request = nil) false # To be overriden in implementation classes. end |
#needs_user? ⇒ Boolean
24 25 26 |
# File 'lib/trebuchet/strategy/logic_base.rb', line 24 def needs_user? false end |