Sha256: 90974e88903765af6a9d4fb401d5758dfc4154913be8f6a8740b08e148f471f2

Contents?: true

Size: 375 Bytes

Versions: 5

Compression:

Stored size: 375 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|on)$/i)
    return false if self == false || self.empty? || self =~ (/(false|f|no|n|0|off)$/i)
    raise ArgumentError.new("invalid value for Boolean: \"#{self}\"")
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
bootstripe-0.2.23 lib/bootstripe/string_additions.rb
bootstripe-0.2.22 lib/bootstripe/string_additions.rb
bootstripe-0.2.20 lib/bootstripe/string_additions.rb
bootstripe-0.2.19 lib/bootstripe/string_additions.rb
bootstripe-0.2.18 lib/bootstripe/string_additions.rb