Class: Ptimelog::App
- Inherits:
-
Object
- Object
- Ptimelog::App
- Defined in:
- lib/ptimelog/app.rb
Overview
Wrapper for everything
Instance Method Summary collapse
-
#initialize(args) ⇒ App
constructor
A new instance of App.
- #run ⇒ Object
Constructor Details
#initialize(args) ⇒ App
Returns a new instance of App.
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/ptimelog/app.rb', line 6 def initialize(args) @config = Configuration.instance command = (args[0] || :show).to_sym @command = case command when :show @date = NamedDate.new.date(args[1]) Command::Show.new when :upload @date = NamedDate.new.date(args[1]) Command::Upload.new when :edit file = args[1] Command::Edit.new(file) else raise ArgumentError, "Unsupported Command #{@command}" end end |
Instance Method Details
#run ⇒ Object
25 26 27 28 29 |
# File 'lib/ptimelog/app.rb', line 25 def run @command.entries = entries if @command.needs_entries? @command.run end |