Class: Travis::Rollout
- Inherits:
-
Object
- Object
- Travis::Rollout
- Defined in:
- lib/travis/rollout.rb,
lib/travis/rollout/version.rb
Constant Summary collapse
- ENVS =
%w(production staging)
- VERSION =
"0.0.1"
Instance Attribute Summary collapse
-
#args ⇒ Object
readonly
Returns the value of attribute args.
-
#block ⇒ Object
readonly
Returns the value of attribute block.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(args = {}, options = {}, &block) ⇒ Rollout
constructor
A new instance of Rollout.
- #matches? ⇒ Boolean
- #run ⇒ Object
Constructor Details
#initialize(args = {}, options = {}, &block) ⇒ Rollout
Returns a new instance of Rollout.
18 19 20 |
# File 'lib/travis/rollout.rb', line 18 def initialize(args = {}, = {}, &block) @args, @options, @block = args, , block end |
Instance Attribute Details
#args ⇒ Object (readonly)
Returns the value of attribute args.
16 17 18 |
# File 'lib/travis/rollout.rb', line 16 def args @args end |
#block ⇒ Object (readonly)
Returns the value of attribute block.
16 17 18 |
# File 'lib/travis/rollout.rb', line 16 def block @block end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
16 17 18 |
# File 'lib/travis/rollout.rb', line 16 def @options end |
Class Method Details
.matches?(*all) ⇒ Boolean
12 13 14 |
# File 'lib/travis/rollout.rb', line 12 def self.matches?(*all) new(*all).matches? end |
.run(*all, &block) ⇒ Object
7 8 9 10 |
# File 'lib/travis/rollout.rb', line 7 def self.run(*all, &block) rollout = new(*all, &block) rollout.run if rollout.matches? end |
Instance Method Details
#matches? ⇒ Boolean
26 27 28 |
# File 'lib/travis/rollout.rb', line 26 def matches? production? and enabled? and (by_owner? or by_repo? or by_user? or by_percent?) end |
#run ⇒ Object
22 23 24 |
# File 'lib/travis/rollout.rb', line 22 def run block.call || true end |