Sha256: cb3945a4c32fac575f6c32bc367173b77d3e5a1d01a5f1b67c42065d831b1bbd

Contents?: true

Size: 371 Bytes

Versions: 4

Compression:

Stored size: 371 Bytes

Contents

require 'yano/version'
require 'yano/lenient'

module Yano
  VALID_YES_VALUE = /^(y|yes|true|1)$/i
  VALID_NO_VALUE  = /^(n|no|false|0)$/i

  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
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
yano-0.1.3 lib/yano.rb
yano-0.1.2 lib/yano.rb
yano-0.1.1 lib/yano.rb
yano-0.1.0 lib/yano.rb