Class: BBK::Utils::Config::BooleanCaster

Inherits:
Object
  • Object
show all
Defined in:
lib/bbk/utils/config.rb

Constant Summary collapse

FALSE_VALUES =
[
  false, 0,
  '0', :"0",
  'f', :f,
  'F', :F,
  'false', false,
  'FALSE', :FALSE,
  'off', :off,
  'OFF', :OFF
].to_set.freeze

Class Method Summary collapse

Class Method Details

.cast(value) ⇒ Object



27
28
29
30
31
32
33
# File 'lib/bbk/utils/config.rb', line 27

def self.cast(value)
  if value.nil? || value == ''
    nil
  else
    !FALSE_VALUES.include?(value)
  end
end