Class: Buildkite::Env

Inherits:
Object
  • Object
show all
Includes:
Fallback
Defined in:
lib/buildkite/env.rb

Defined Under Namespace

Modules: Fallback

Constant Summary collapse

BUILDKITE =
'BUILDKITE'
PREFIX =
"#{BUILDKITE}_"

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Fallback

#method_missing, #respond_to_missing?

Constructor Details

#initialize(env) ⇒ Env

Returns a new instance of Env.



31
32
33
# File 'lib/buildkite/env.rb', line 31

def initialize(env)
  @env = env
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Buildkite::Env::Fallback

Class Method Details

.load(env) ⇒ Object



27
28
29
# File 'lib/buildkite/env.rb', line 27

def self.load(env)
  new(env) if env[BUILDKITE]
end

Instance Method Details

#default_branch?Boolean

Returns:

  • (Boolean)


35
36
37
# File 'lib/buildkite/env.rb', line 35

def default_branch?
  pipeline_default_branch == branch
end

#pull_requestObject



39
40
41
# File 'lib/buildkite/env.rb', line 39

def pull_request
  super == 'false' ? false : Integer(super)
end