Sha256: 022d3ff232be06c9852d4659c7fa76bb1f9837a3844c544094ff33df57a26c1e

Contents?: true

Size: 294 Bytes

Versions: 5

Compression:

Stored size: 294 Bytes

Contents

class String
  
  # "FooBar".snake_case #=> "foo_bar"
  def snake_case
    gsub(/\B[A-Z]/, '_\&').downcase
  end

  # "foo_bar".camel_case #=> "FooBar"
  def camel_case
    split('_').map{|e| e.capitalize}.join
  end

  # Concatenates a path
  def /(o)
    File.join(self, o.to_s)
  end
  
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
merb-0.3.0 lib/merb/core_ext/merb_string.rb
merb-0.3.1 lib/merb/core_ext/merb_string.rb
merb-0.3.3 lib/merb/core_ext/merb_string.rb
merb-0.3.4 lib/merb/core_ext/merb_string.rb
merb-0.3.7 lib/merb/core_ext/merb_string.rb