Class: Umwelt::History::Mapper

Inherits:
Abstract::Mapper show all
Defined in:
lib/umwelt/history/mapper.rb

Instance Method Summary collapse

Methods inherited from Abstract::Mapper

#fill

Methods inherited from Abstract::Interactor

#prove

Instance Method Details

#call(data = { project: {}, phases: [] }) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/umwelt/history/mapper.rb', line 8

def call(
  data = {
    project: {},
    phases: []
  }
)

  @struct = Struct::History.new(
    project: project(data[:project]),
    phases: phases(data[:phases])
  )
end

#phase(data) ⇒ Object



29
30
31
# File 'lib/umwelt/history/mapper.rb', line 29

def phase(data)
  fill(Struct::Phase, data)
end

#phases(phases_data) ⇒ Object



21
22
23
# File 'lib/umwelt/history/mapper.rb', line 21

def phases(phases_data)
  phases_data.map { |phase_data| phase(phase_data) }
end

#project(data) ⇒ Object



25
26
27
# File 'lib/umwelt/history/mapper.rb', line 25

def project(data)
  fill(Struct::Project, data)
end