Class: Nenv::Environment::Loader

Inherits:
Object
  • Object
show all
Defined in:
lib/nenv/environment/loader.rb

Instance Method Summary collapse

Constructor Details

#initialize(meth) ⇒ Loader

Returns a new instance of Loader.


4
5
6
# File 'lib/nenv/environment/loader.rb', line 4

def initialize(meth)
  @bool = meth.to_s.end_with?('?')
end

Instance Method Details

#load(raw_value, &callback) ⇒ Object


8
9
10
11
# File 'lib/nenv/environment/loader.rb', line 8

def load(raw_value, &callback)
  return callback.call(raw_value) if callback
  @bool ? _to_bool(raw_value) : raw_value
end