Method: String#clip

Defined in:
lib/wwmd/class_extensions/extensions_base.rb

#clip(pref = "?") ⇒ Object

return everything in the string (url) before the first get param “foo.bar.com/page.asp?somearg=foo&otherarg=bar”.clip

> “foo.bar.com/page.asp



73
74
75
76
77
78
# File 'lib/wwmd/class_extensions/extensions_base.rb', line 73

def clip(pref="?")
  if (v = self.index(pref))
    return self[0..(v-1)]
  end
  return self
end