Class: Publicity::Exec
- Inherits:
-
Object
- Object
- Publicity::Exec
- Defined in:
- lib/publicity.rb
Overview
Kicks off the parsing process by parsing command-line arguments and calling the method that parses each input file.
Instance Method Summary collapse
-
#initialize(args) ⇒ Exec
constructor
A new instance of Exec.
-
#parse ⇒ Object
Parses the command-line arguments and begins parsing the files.
-
#parse! ⇒ Object
Parses the command-line arguments and begins parsing the files.
-
#process_result ⇒ Object
Kickstarts the script prompt.
-
#set_opts(opts) ⇒ Object
Takes the command-line arguments and parses them for optparse.
Constructor Details
#initialize(args) ⇒ Exec
Returns a new instance of Exec.
11 12 13 14 |
# File 'lib/publicity.rb', line 11 def initialize(args) @args = args @options = {} end |
Instance Method Details
#parse ⇒ Object
Parses the command-line arguments and begins parsing the files.
27 28 29 30 31 32 |
# File 'lib/publicity.rb', line 27 def parse @opts = OptionParser.new(&method(:set_opts)) @opts.parse!(@args) process_result end |
#parse! ⇒ Object
Parses the command-line arguments and begins parsing the files.
19 20 21 22 |
# File 'lib/publicity.rb', line 19 def parse! parse exit 0 end |
#process_result ⇒ Object
Kickstarts the script prompt
59 60 61 |
# File 'lib/publicity.rb', line 59 def process_result Publicity::Main.new end |
#set_opts(opts) ⇒ Object
Takes the command-line arguments and parses them for optparse.
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/publicity.rb', line 37 def set_opts(opts) opts. = <<EOS publicity v#{Publicity::VERSION} Description: TODO Usage (from within a .git repository): publicity [options] Options: EOS opts.on_tail( '-h', '--help', 'Display this screen' ) do puts opts exit end end |