Class: Herodot::ProjectLink

Inherits:
Object
  • Object
show all
Defined in:
lib/herodot/project_link.rb

Constant Summary collapse

PROJECT_CONFIG =
'.herodot.yml'.freeze

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(worklog) ⇒ ProjectLink

Returns a new instance of ProjectLink.



16
17
18
19
# File 'lib/herodot/project_link.rb', line 16

def initialize(worklog)
  @worklog = worklog
  @project_configurations = {}
end

Class Method Details



9
10
11
12
13
14
# File 'lib/herodot/project_link.rb', line 9

def self.link(path, link, pattern)
  puts "Write link into #{project_config_file(path)}"
  File.open(project_config_file(path), 'w') do |f|
    YAML.dump({ link: link, pattern: pattern }, f)
  end
end

.project_config_file(path) ⇒ Object



5
6
7
# File 'lib/herodot/project_link.rb', line 5

def self.project_config_file(path)
  File.join(File.expand_path(path), PROJECT_CONFIG)
end

Instance Method Details

#totalsObject



21
22
23
24
25
# File 'lib/herodot/project_link.rb', line 21

def totals
  @worklog.totals.map do |date, logs|
    [date, decorated_logs(logs)]
  end
end