Module: Kernel

Defined in:
lib/distil/configurable.rb

Instance Method Summary collapse

Instance Method Details

#Boolean(string) ⇒ Object

Raises:

  • (ArgumentError)


3
4
5
6
7
# File 'lib/distil/configurable.rb', line 3

def Boolean(string)
  return true if string == true || string =~ /^true$/i
  return false if string == false || string.nil? || string =~ /^false$/i
  raise ArgumentError.new("invalid value for Boolean: \"#{string}\"")
end