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.freeze
VALID_NO_VALUE =
/^(n|no|false|0)$/i.freeze
VERSION =
'0.1.5'

Class Method Summary collapse

Class Method Details

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



10
11
12
13
14
15
# File 'lib/yano.rb', line 10

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