Module: CypressRails::Env

Defined in:
lib/cypress-rails/env.rb

Class Method Summary collapse

Class Method Details

.fetch(name, type: :string, default: nil) ⇒ Object



3
4
5
6
7
8
9
10
11
12
# File 'lib/cypress-rails/env.rb', line 3

def self.fetch(name, type: :string, default: nil)
  return default unless ENV.key?(name)

  if type == :boolean
    no_like_flag = ["", "0", "n", "no", "false"].include?(ENV.fetch(name))
    !no_like_flag
  else
    ENV.fetch(name)
  end
end