Module: HTTY::CLI::UrlEscaping

Includes:
Display
Included in:
Commands::FragmentSet, Commands::PathSet, Commands::QueryAdd, Commands::QueryRemove, Commands::QuerySet, Commands::QueryUnset, Commands::UserinfoSet
Defined in:
lib/htty/cli/url_escaping.rb

Overview

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

Constant Summary

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

- (Object) escape_or_warn_of_escape_sequences(arguments)



13
14
15
16
17
18
19
20
21
22
23
# File 'lib/htty/cli/url_escaping.rb', line 13

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