Sha256: 74bac21e2b891b1816dd1d93efda1b06e6610a45d9d1349519d5c8ab17dcd641

Contents?: true

Size: 394 Bytes

Versions: 1

Compression:

Stored size: 394 Bytes

Contents

# frozen_string_literal: true

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 Lenient.check_lenient_values(val) if opts.delete(:lenient)
    return true  if val =~ VALID_YES_VALUE
    return false if val =~ VALID_NO_VALUE
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
yano-0.1.4 lib/yano.rb