Class: String
- Inherits:
-
Object
- Object
- String
- Defined in:
- lib/bootstripe/string_additions.rb
Instance Method Summary collapse
Instance Method Details
#decapitalize ⇒ Object
2 3 4 |
# File 'lib/bootstripe/string_additions.rb', line 2 def decapitalize self[0, 1].downcase + self[1..-1] end |
#to_bool ⇒ Object
10 11 12 13 14 |
# File 'lib/bootstripe/string_additions.rb', line 10 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 |
#to_class ⇒ Object
6 7 8 |
# File 'lib/bootstripe/string_additions.rb', line 6 def to_class Object.const_get(self) end |