Class: String
- Inherits:
-
Object
- Object
- String
- Defined in:
- lib/babosa.rb
Instance Method Summary collapse
- #bytesize ⇒ Object
-
#classify ⇒ Object
Convert from underscores to class name.
- #to_identifier ⇒ Object (also: #to_slug)
Instance Method Details
#bytesize ⇒ Object
15 16 17 |
# File 'lib/babosa.rb', line 15 def bytesize unpack("C*").length end |
#classify ⇒ Object
Convert from underscores to class name. E.g.:
hello_world => HelloWorld
24 25 26 |
# File 'lib/babosa.rb', line 24 def classify split("_").map {|a| a.gsub(/\b('?[a-z])/) { $1.upcase }}.join end |
#to_identifier ⇒ Object Also known as: to_slug
8 9 10 |
# File 'lib/babosa.rb', line 8 def to_identifier Babosa::Identifier.new self end |