Class: Timetrap::Formatters::Harvest

Inherits:
Object
  • Object
show all
Defined in:
lib/timetrap-harvest.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(entries) ⇒ Harvest

Returns a new instance of Harvest.



21
22
23
# File 'lib/timetrap-harvest.rb', line 21

def initialize(entries)
  @entries = entries
end

Instance Attribute Details

#client=(value) ⇒ Object

Sets the attribute client

Parameters:

  • value

    the value to set the attribute client to.



19
20
21
# File 'lib/timetrap-harvest.rb', line 19

def client=(value)
  @client = value
end

#config=(value) ⇒ Object

Sets the attribute config

Parameters:

  • value

    the value to set the attribute config to.



19
20
21
# File 'lib/timetrap-harvest.rb', line 19

def config=(value)
  @config = value
end

#entriesObject (readonly)

Returns the value of attribute entries.



18
19
20
# File 'lib/timetrap-harvest.rb', line 18

def entries
  @entries
end

Instance Method Details

#outputObject



25
26
27
28
29
30
31
32
# File 'lib/timetrap-harvest.rb', line 25

def output
  results = entries.map { |entry| TimetrapHarvest::Formatter.new(entry, config).format }

  harvester = TimetrapHarvest::Harvester.new(results, client)
  results   = harvester.harvest

  TimetrapHarvest::Output.new(results).generate
end