Class: String

Inherits:
Object
  • Object
show all
Defined in:
lib/babosa.rb

Instance Method Summary collapse

Instance Method Details

#bytesizeObject



15
16
17
# File 'lib/babosa.rb', line 15

def bytesize
  unpack("C*").length
end

#classifyObject

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_identifierObject Also known as: to_slug



8
9
10
# File 'lib/babosa.rb', line 8

def to_identifier
  Babosa::Identifier.new self
end