Sha256: cbc0c17f42d4c080bb1cf8dfe2109862917feb43429f76bd48fe81fa38844f10

Contents?: true

Size: 618 Bytes

Versions: 3

Compression:

Stored size: 618 Bytes

Contents

# frozen_string_literal: true

require_relative '../structs/phase'
require_relative '../structs/project'

module Umwelt::History
  class Mapper < Umwelt::Abstract::Mapper
    def call(
      data = {
        project: {},
        phases: []
      }
    )

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

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

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

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

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
umwelt-0.2 lib/umwelt/history/mapper.rb
umwelt-0.1.1 lib/umwelt/history/mapper.rb
umwelt-0.1.0 lib/umwelt/history/mapper.rb