Module: Geokit::Inflector

Defined in:
lib/geokit/inflector.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.bytesize(string) ⇒ Object

Ruby 1.8



10
11
12
# File 'lib/geokit/inflector.rb', line 10

def bytesize(string)
  string.bytesize
end

Instance Method Details

#url_escape(s) ⇒ Object



16
17
18
19
20
# File 'lib/geokit/inflector.rb', line 16

def url_escape(s)
  s.gsub(/([^ a-zA-Z0-9_.-]+)/nu) {
    '%' + $1.unpack('H2' * bytesize($1)).join('%').upcase
  }.tr(' ', '+')
end