Parent

Class/Module Index [+]

Quicksearch

String

Public Instance Methods

camelize() click to toggle source
# File lib/hammer_cli/utils.rb, line 18
def camelize()
  return self if self !~ /_/ && self =~ /[A-Z]+.*/
  split('_').map{|e| e.capitalize}.join
end
format(params) click to toggle source

string formatting for ruby 1.8

# File lib/hammer_cli/utils.rb, line 5
def format(params)
  if params.is_a? Hash
    array_params = self.scan(/%[<{]([^>}]*)[>}]/).collect do |name|
      name = name[0]
      params[name.to_s] || params[name.to_sym]
    end

    self.gsub(/%[<{]([^>}]*)[>}]/, '%') % array_params
  else
    self % params
  end
end
indent_with(indent_str) click to toggle source
# File lib/hammer_cli/utils.rb, line 23
def indent_with(indent_str)
  gsub(/^/, indent_str)
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.