Module: HTTY::CLI::UrlEscaping

Overview

Encapsulates the URL escaping logic of htty’s command-line interface.

Constant Summary

Constants included from Display

Display::FORMATS

Instance Method Summary collapse

Methods included from Display

#break, #format, #formatted_prompt_for, #indent, #logotype, #normal, #notice, #pluralize, #rescuing_from, #say, #say_goodbye, #say_header, #say_hello, #show_headers, #show_request, #show_response, #strong, #word_wrap, #word_wrap_indented

Instance Method Details

#escape_or_warn_of_escape_sequences(arguments) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
# File 'lib/htty/cli/url_escaping.rb', line 8

def escape_or_warn_of_escape_sequences(arguments)
  arguments.collect do |a|
    if a =~ /%[0-9a-f]{2}/i
      say "Argument '#{a}' was not URL-escaped because it contains escape " +
          'sequences'
      a
    else
      HTTY::URI.escape_component(a)
    end
  end
end