Sha256: a0c971b80a1f7b4abbe808c05079f3107ab1116e0c7c40f4a571e1c5084258e4

Contents?: true

Size: 368 Bytes

Versions: 3

Compression:

Stored size: 368 Bytes

Contents

class String
  def decapitalize
    self[0, 1].downcase + self[1..-1]
  end

  def to_class
    Object.const_get(self)
  end

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

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
bootstripe-0.2.17 lib/bootstripe/string_additions.rb
bootstripe-0.2.16 lib/bootstripe/string_additions.rb
bootstripe-0.2.15 lib/bootstripe/string_additions.rb