Module: DSL::Maker::Boolean

Defined in:
lib/dsl/maker.rb

Overview

This is a useful module that contains all the Boolean handling we need.

Class Method Summary collapse

Class Method Details

.coerce(value) ⇒ Object



57
58
59
60
61
62
63
# File 'lib/dsl/maker.rb', line 57

def self.coerce(value)
  if value
    return false if %w(no off false nil).include? value.to_s.downcase
  end
  # The bang-bang boolean-izes the value. We want this to be lossy.
  !!value
end