Class: Artisan::Activity::ActivityPresenter

Inherits:
Object
  • Object
show all
Defined in:
lib/artisan/activity/activity_presenter.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(changes, project) ⇒ ActivityPresenter

Returns a new instance of ActivityPresenter.



11
12
13
14
# File 'lib/artisan/activity/activity_presenter.rb', line 11

def initialize(changes, project)
  @changes = changes
  @project = project
end

Instance Attribute Details

#projectObject (readonly)

Returns the value of attribute project.



9
10
11
# File 'lib/artisan/activity/activity_presenter.rb', line 9

def project
  @project
end

Instance Method Details

#changesObject



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/artisan/activity/activity_presenter.rb', line 16

def changes
  changes = []
  @changes.each do |change|
    temporal = Formatters::Temporal.new(change)

    changes << {
      :date   => temporal.date,
      :time   => temporal.time,
      :who    => Formatters::Name.new(change).full_name,
      :what   => Formatters::Source.new(change).type,
      :diffs  => Formatters::DiffChanges.new(change).diffs,
      :event  => change.event
      }
  end
  return changes
end