Geokit::Inflector

Public Instance Methods

camelize(str) click to toggle source

(Not documented)

    # File /Users/andre/projects/rails/geokit/lib/geokit/geocoders.rb, line 45
45:     def camelize(str)
46:       str.split('_').map {|w| w.capitalize}.join
47:     end
humanize(lower_case_and_underscored_word) click to toggle source

(Not documented)

    # File /Users/andre/projects/rails/geokit/lib/geokit/geocoders.rb, line 28
28:     def humanize(lower_case_and_underscored_word)
29:       lower_case_and_underscored_word.to_s.gsub(/_id$/, "").gsub(/_/, " ").capitalize
30:     end
snake_case(s) click to toggle source

(Not documented)

    # File /Users/andre/projects/rails/geokit/lib/geokit/geocoders.rb, line 32
32:     def snake_case(s)
33:       return s.downcase if s =~ /^[A-Z]+$/u
34:       s.gsub(/([A-Z]+)(?=[A-Z][a-z]?)|\B[A-Z]/u, '_\&') =~ /_*(.*)/
35:         return $+.downcase
36:       
37:     end
titleize(word) click to toggle source

(Not documented)

    # File /Users/andre/projects/rails/geokit/lib/geokit/geocoders.rb, line 16
16:     def titleize(word)
17:       humanize(underscore(word)).gsub(/\b([a-z])/u) { $1.capitalize }
18:     end
underscore(camel_cased_word) click to toggle source

(Not documented)

    # File /Users/andre/projects/rails/geokit/lib/geokit/geocoders.rb, line 20
20:     def underscore(camel_cased_word)
21:       camel_cased_word.to_s.gsub(/::/, '/').
22:       gsub(/([A-Z]+)([A-Z][a-z])/u,'\1_\2').
23:       gsub(/([a-z\d])([A-Z])/u,'\1_\2').
24:       tr("-", "_").
25:       downcase
26:     end
url_escape(s) click to toggle source

(Not documented)

    # File /Users/andre/projects/rails/geokit/lib/geokit/geocoders.rb, line 39
39:     def url_escape(s)
40:     s.gsub(/([^ a-zA-Z0-9_.-]+)/nu) do
41:       '%' + $1.unpack('H2' * $1.size).join('%').upcase
42:       end.tr(' ', '+')
43:     end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.