Parent

Forgery::Extensions::String

Public Instance Methods

camelize(first_letter = :upper) click to toggle source

Ripped right out of rails

# File lib/forgery/extensions/string.rb, line 14
def camelize(first_letter = :upper)
  case first_letter
  when :upper
    to_s.gsub(/\/(.?)/) { "::#{$1.upcase}" }.gsub(/(?:^|_)(.)/) { $1.upcase }
  when :lower
    first.downcase + camelize(self)[1..-1]
  end
end
constantize() click to toggle source
# File lib/forgery/extensions/string.rb, line 24
def constantize
  names = self.split('::')
  names.shift if names.empty? || names.first.empty?

  constant = Object
  names.each do |name|
    constant = constant.const_defined?(name) ? constant.const_get(name) : constant.const_missing(name)
  end
  constant
end
to_numbers(replace='#') click to toggle source
# File lib/forgery/extensions/string.rb, line 9
def to_numbers(replace='#')
  gsub(/#{replace}/){ Kernel.rand(10) }
end
unextend() click to toggle source
# File lib/forgery/extensions/string.rb, line 5
def unextend
  to_s
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.