Sha256: 3f59180e4032e5b92d4feafc8bf24e241eb90241ec6911dd5bf823b3654f9a90

Contents?: true

Size: 590 Bytes

Versions: 9

Compression:

Stored size: 590 Bytes

Contents

# This file extends core Ruby classes! Please make sure it doesn't create conflicts

class String
  # returns snake_case representation of string
  def snake_case
    gsub(/([a-z])([A-Z0-9])/, '\1_\2' ).downcase
  end

  # returns camel_case representation of string
  def camel_case
    if self.include? '_'
      self.split('_').map{|e| e.capitalize}.join
    else
      unless self =~ (/^[A-Z]/)
        self.capitalize
      else
        self
      end
    end
  end

  # converts string to 'wide char' (Windows Unicode) format
  def to_w
    (self+"\x00").encode('utf-16LE')
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
win-0.3.27 lib/extension.rb
win-0.3.26 lib/extension.rb
win-0.3.25 lib/extension.rb
win-0.3.24 lib/extension.rb
win-0.3.17 lib/extension.rb
win-0.3.16 lib/extension.rb
win-0.3.11 lib/extension.rb
win-0.3.8 lib/extension.rb
win-0.3.7 lib/extension.rb