Sha256: 267f86fd1692d5ec0bb73f71c25430293fbe22fc29175974cd8ab821b10ceafc
Contents?: true
Size: 473 Bytes
Versions: 4
Compression:
Stored size: 473 Bytes
Contents
class String # string formatting for ruby 1.8 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 def camelize() return self if self !~ /_/ && self =~ /[A-Z]+.*/ split('_').map{|e| e.capitalize}.join end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
hammer_cli-0.0.18 | lib/hammer_cli/utils.rb |
hammer_cli-0.0.16 | lib/hammer_cli/utils.rb |
hammer_cli-0.0.15 | lib/hammer_cli/utils.rb |
hammer_cli-0.0.14 | lib/hammer_cli/utils.rb |