Class: Runoff::Commandline::Command
- Inherits:
-
Object
- Object
- Runoff::Commandline::Command
- Defined in:
- lib/runoff/commandline/command.rb
Overview
Public: A base class for all runoff commands except None.
Should be used only by inheriting.
Instance Attribute Summary collapse
-
#parser ⇒ Object
readonly
Public: Returns an OptionParser object.
Instance Method Summary collapse
-
#execute(args) {|chat, file_writer| ... } ⇒ Object
Public: executes the command.
Instance Attribute Details
#parser ⇒ Object (readonly)
Public: Returns an OptionParser object
14 15 16 |
# File 'lib/runoff/commandline/command.rb', line 14 def parser @parser end |
Instance Method Details
#execute(args) {|chat, file_writer| ... } ⇒ Object
Public: executes the command.
args - An Array of commandline arguments.
19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/runoff/commandline/command.rb', line 19 def execute(args) puts 'Exporting...'.colorize :green db_location = Location.get_database_path args, @options chat = Chat.new db_location, @options file_writer = FileWriter.new @options yield chat, file_writer if block_given? file_writer.archive if @options[:archive] puts 'Finished.'.colorize :green end |