Class: EnvBranch::Base
- Inherits:
-
Object
- Object
- EnvBranch::Base
- Defined in:
- lib/env_branch/base.rb
Instance Attribute Summary collapse
-
#branch_name ⇒ Object
readonly
Returns the value of attribute branch_name.
Instance Method Summary collapse
- #branch? ⇒ Boolean
- #fetch_branch_name ⇒ Object
-
#initialize ⇒ Base
constructor
A new instance of Base.
Constructor Details
#initialize ⇒ Base
Returns a new instance of Base.
5 6 7 |
# File 'lib/env_branch/base.rb', line 5 def initialize @branch_name = fetch_branch_name end |
Instance Attribute Details
#branch_name ⇒ Object (readonly)
Returns the value of attribute branch_name.
3 4 5 |
# File 'lib/env_branch/base.rb', line 3 def branch_name @branch_name end |
Instance Method Details
#branch? ⇒ Boolean
26 27 28 |
# File 'lib/env_branch/base.rb', line 26 def branch? !branch_name.nil? end |
#fetch_branch_name ⇒ Object
travis-ci.org:
ENV['TRAVIS_BRANCH']
circleci.com:
ENV['CIRCLE_BRANCH']
18 19 20 21 22 23 24 |
# File 'lib/env_branch/base.rb', line 18 def fetch_branch_name if ENV['TRAVIS_BRANCH'] && !ENV['TRAVIS_BRANCH'].empty? ENV['TRAVIS_BRANCH'] elsif ENV['CIRCLE_BRANCH'] && !ENV['CIRCLE_BRANCH'].empty? ENV['CIRCLE_BRANCH'] end end |