Class: Unfig::EnvReader

Inherits:
Object
  • Object
show all
Defined in:
lib/unfig/env_reader.rb

Constant Summary collapse

TRUTHY_STRINGS =
%w[true yes on enable allow t y 1 ok okay].to_set.freeze
FALSEY_STRINGS =
%w[false no off disabled disable deny f n 0 nope].to_set.freeze

Instance Method Summary collapse

Constructor Details

#initialize(param:, env:) ⇒ EnvReader

Returns a new instance of EnvReader.



6
7
8
9
# File 'lib/unfig/env_reader.rb', line 6

def initialize(param:, env:)
  @param = param
  @env = env
end

Instance Method Details

#supplied?Boolean

Returns:

  • (Boolean)


11
# File 'lib/unfig/env_reader.rb', line 11

def supplied? = multi? ? multi_keys_supplied? : key_supplied?

#valueObject



13
14
15
16
17
18
19
# File 'lib/unfig/env_reader.rb', line 13

def value
  if multi?
    supplied? ? multi_values : []
  else
    supplied? ? single_value : nil
  end
end