module Buildkite::Env::Fallback

Public Instance Methods

method_missing(method_name, *_args, &_block) click to toggle source
# File lib/buildkite/env.rb, line 9
def method_missing(method_name, *_args, &_block) # rubocop:disable Style/MethodMissingSuper
  env_name = "#{PREFIX}#{method_name.to_s.gsub(/\?\z/, '').upcase}"

  if method_name.to_s.end_with?('?')
    @env.key?(env_name)
  elsif @env.key?(env_name)
    @env.fetch(env_name)
  else
    raise NoMethodError, "undefined method #{method_name} for #{self} because ENV[\"#{env_name}\"] is not defined"
  end
end
respond_to_missing?(method_name, include_private = false) click to toggle source
Calls superclass method
# File lib/buildkite/env.rb, line 21
def respond_to_missing?(method_name, include_private = false)
  method_name.to_s.end_with?('?') || @env.key?("#{PREFIX}#{method_name.upcase}") || super
end