Class: Travis::Rollout
- Inherits:
-
Object
- Object
- Travis::Rollout
- Defined in:
- lib/travis/rollout.rb,
lib/travis/rollout/version.rb
Defined Under Namespace
Classes: ByPercent, ByValue, Env, Redis, RedisNoop
Constant Summary collapse
- VERSION =
"0.0.2"
Instance Attribute Summary collapse
-
#args ⇒ Object
readonly
Returns the value of attribute args.
-
#block ⇒ Object
readonly
Returns the value of attribute block.
-
#env ⇒ Object
readonly
Returns the value of attribute env.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#redis ⇒ Object
readonly
Returns the value of attribute redis.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(name, args, &block) ⇒ Rollout
constructor
A new instance of Rollout.
- #matches? ⇒ Boolean
- #run ⇒ Object
Constructor Details
Instance Attribute Details
#args ⇒ Object (readonly)
Returns the value of attribute args.
79 80 81 |
# File 'lib/travis/rollout.rb', line 79 def args @args end |
#block ⇒ Object (readonly)
Returns the value of attribute block.
79 80 81 |
# File 'lib/travis/rollout.rb', line 79 def block @block end |
#env ⇒ Object (readonly)
Returns the value of attribute env.
79 80 81 |
# File 'lib/travis/rollout.rb', line 79 def env @env end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
79 80 81 |
# File 'lib/travis/rollout.rb', line 79 def name @name end |
#redis ⇒ Object (readonly)
Returns the value of attribute redis.
79 80 81 |
# File 'lib/travis/rollout.rb', line 79 def redis @redis end |
Class Method Details
.matches?(*all) ⇒ Boolean
75 76 77 |
# File 'lib/travis/rollout.rb', line 75 def self.matches?(*all) new(*all).matches? end |
.run(*all, &block) ⇒ Object
70 71 72 73 |
# File 'lib/travis/rollout.rb', line 70 def self.run(*all, &block) rollout = new(*all, &block) rollout.run if rollout.matches? end |
Instance Method Details
#matches? ⇒ Boolean
93 94 95 |
# File 'lib/travis/rollout.rb', line 93 def matches? enabled? and (by_value? or by_percent?) end |
#run ⇒ Object
89 90 91 |
# File 'lib/travis/rollout.rb', line 89 def run block.call || true end |