Method: Rodbot::Refinements#uri_concat
- Defined in:
- lib/rodbot/refinements.rb
#uri_concat ⇒ String
Safely concat path segments to a URI string
URI#join is ultimately used to add the given segments which has a maybe counter-intuitive API at first. Check out the docs of URI#join and the examples below.
53 54 55 56 57 58 59 60 |
# File 'lib/rodbot/refinements.rb', line 53 refine String do def uri_concat(*segments) parser = URI::RFC2396_PARSER segments.inject(URI(self)) do |uri, segment| uri + parser.escape(segment) end.to_s end end |