Class: Shamu::Features::Conditions::Condition
- Inherits:
-
Object
- Object
- Shamu::Features::Conditions::Condition
- Defined in:
- lib/shamu/features/conditions/condition.rb
Overview
Direct Known Subclasses
Env, Hosts, Matching, Percentage, Proc, Roles, ScheduleAt
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(config, toggle) ⇒ Condition
constructor
A new instance of Condition.
-
#match?(context) ⇒ Boolean
True if the condition matches the given environment.
Constructor Details
#initialize(config, toggle) ⇒ Condition
Returns a new instance of Condition.
20 21 22 23 |
# File 'lib/shamu/features/conditions/condition.rb', line 20 def initialize( config, toggle ) @config = config @toggle = toggle end |
Class Method Details
.create(name, config, toggle) ⇒ Object
11 12 13 14 15 16 17 |
# File 'lib/shamu/features/conditions/condition.rb', line 11 def self.create( name, config, toggle ) @condition_class ||= Hash.new do |hash, key| hash[key] = "Shamu::Features::Conditions::#{ key.to_s.camelize }".constantize end @condition_class[name].new config, toggle end |
Instance Method Details
#match?(context) ⇒ Boolean
Returns true if the condition matches the given environment.
27 28 29 |
# File 'lib/shamu/features/conditions/condition.rb', line 27 def match?( context ) fail NotImplementedError end |