Class: Ptimelog::Command::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/ptimelog/command/base.rb

Overview

Foundation and common API for all commands

Direct Known Subclasses

Add, Edit, Show, Upload, Version

Instance Method Summary collapse

Constructor Details

#initialize(day = nil) ⇒ Base



7
8
9
10
11
12
13
14
# File 'lib/ptimelog/command/base.rb', line 7

def initialize(day = nil)
  @config = Configuration.instance

  return unless needs_entries?

  @entries = {}
  self.entries = Ptimelog::Day.new(day).entries
end

Instance Method Details

#entries=(_values) ⇒ Object



24
25
26
# File 'lib/ptimelog/command/base.rb', line 24

def entries=(_values)
  raise 'Implement a entries-writer-method for your command' if needs_entries?
end

#needs_entries?Boolean



16
17
18
# File 'lib/ptimelog/command/base.rb', line 16

def needs_entries?
  false
end

#runObject



20
21
22
# File 'lib/ptimelog/command/base.rb', line 20

def run
  raise 'Implement a run-method for your command'
end