Class: Embedly::CommandLine::Parser

Inherits:
Object
  • Object
show all
Defined in:
lib/embedly/command_line.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(args) ⇒ Parser

Returns a new instance of Parser.



9
10
11
# File 'lib/embedly/command_line.rb', line 9

def initialize(args)
  @options, @args = default, args
end

Instance Attribute Details

#optionsObject

Returns the value of attribute options.



7
8
9
# File 'lib/embedly/command_line.rb', line 7

def options
  @options
end

Class Method Details

.parse!(args) ⇒ Object



24
25
26
# File 'lib/embedly/command_line.rb', line 24

def self.parse!(args)
  new(args).parse!
end

Instance Method Details

#parse!Object



13
14
15
16
17
18
19
20
21
22
# File 'lib/embedly/command_line.rb', line 13

def parse!
  parser.parse!(@args)
  set_urls!
  reject_nil!
  options
rescue OptionParser::InvalidOption => error
  puts "ERROR: #{error.message}"
  puts parser.on_tail
  exit
end