Module: Yano

Defined in:
lib/yano.rb,
lib/yano/lenient.rb,
lib/yano/version.rb

Defined Under Namespace

Modules: Lenient

Constant Summary collapse

VALID_YES_VALUE =
/^(y|yes|true|1)$/i
VALID_NO_VALUE =
/^(n|no|false|0)$/i
VERSION =
"0.1.2"

Class Method Summary collapse

Class Method Details

.parse(val, opts = {}) ⇒ Object



8
9
10
11
12
13
# File 'lib/yano.rb', line 8

def self.parse(val, opts = {})
  val = val.to_s.strip
  return true  if !!(val =~ VALID_YES_VALUE)
  return false if !!(val =~ VALID_NO_VALUE)
  return Lenient.check_lenient_values(val) if opts.delete(:lenient)
end