Class: String
- Inherits:
-
Object
- Object
- String
- Defined in:
- lib/magellan/extensions/string.rb
Instance Method Summary collapse
Instance Method Details
#remove_fragment ⇒ Object
18 19 20 |
# File 'lib/magellan/extensions/string.rb', line 18 def remove_fragment self.gsub(/#.*/,'') end |
#to_absolute_url(origin_url) ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/magellan/extensions/string.rb', line 4 def to_absolute_url(origin_url) begin #BUG in URI.join? URI.join('http://www.google.com/index.html?foo=b','?foo=a') # => http://www.google.com/?foo=a stripped = self.strip if stripped.starts_with?('?') origin_url.gsub(/\?.*/,'') + stripped else URI.join(origin_url,stripped).to_s end rescue self end end |