Class: Noir::Command::Format::PDFURL

Inherits:
Base::TerminalCommand show all
Defined in:
lib/noir/command/format/pdf_url.rb

Class Method Summary collapse

Methods inherited from Base::TerminalCommand

sub_commands

Methods inherited from Base::Command

check_command_not_found, description, sub_commands

Class Method Details

.execute(*args) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/noir/command/format/pdf_url.rb', line 6

def self.execute *args
  raise 'URL Missing. Please input a link in argument.'if args.empty?

  args.each do |url|
    if URI.regexp.match(url)
      puts URI.decode_www_form(url).find{|a| a.first == 'url'}
    else
      puts 'PDF URL missing'
    end
  end

end