Sha256: 5c8bdf1bafa5494503bf74fdbc3110a484c994e77255b9bfcb006b4d583f9784

Contents?: true

Size: 252 Bytes

Versions: 8

Compression:

Stored size: 252 Bytes

Contents

class String
  def to_b
    return true if self == true || self =~ (/(true|t|yes|y|1)$/i)
    return false if self == false || self.blank? || self =~ (/(false|f|no|n|0)$/i)
    raise ArgumentError.new("invalid value for Boolean: \"#{self}\"")
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
gooddata-0.6.43 lib/gooddata/extensions/string.rb
gooddata-0.6.42 lib/gooddata/extensions/string.rb
gooddata-0.6.41 lib/gooddata/extensions/string.rb
gooddata-0.6.40 lib/gooddata/extensions/string.rb
gooddata-0.6.39 lib/gooddata/extensions/string.rb
gooddata-0.6.38 lib/gooddata/extensions/string.rb
gooddata-0.6.37 lib/gooddata/extensions/string.rb
gooddata-0.6.36 lib/gooddata/extensions/string.rb