Sha256: 03f9e4135e7aed3cebf41c6b3c444a4a8f94dbe09a4cc8547be21c2cf68eb3bf

Contents?: true

Size: 704 Bytes

Versions: 48

Compression:

Stored size: 704 Bytes

Contents

# frozen_string_literal: true

require_relative '../../models/entry'

module Dsu
  module Services
    module Entry
      class HydratorService
        def initialize(entries_array:, options: {})
          raise ArgumentError, 'entries_array is nil' if entries_array.nil?
          raise ArgumentError, 'options is nil' if options.nil?

          @entries_array = entries_array
          @options = options || {}
        end

        def call
          hydrate
        end

        private

        attr_reader :entries_array, :options

        def hydrate
          entries_array.map do |entry_hash|
            Dsu::Models::Entry.new(**entry_hash)
          end
        end
      end
    end
  end
end

Version data entries

48 entries across 48 versions & 1 rubygems

Version Path
dsu-3.0.5 lib/dsu/services/entry/hydrator_service.rb
dsu-3.0.4 lib/dsu/services/entry/hydrator_service.rb
dsu-3.0.3 lib/dsu/services/entry/hydrator_service.rb
dsu-3.0.1 lib/dsu/services/entry/hydrator_service.rb
dsu-3.0.0 lib/dsu/services/entry/hydrator_service.rb
dsu-3.0.0.beta.3 lib/dsu/services/entry/hydrator_service.rb
dsu-3.0.0.beta.2 lib/dsu/services/entry/hydrator_service.rb
dsu-3.0.0.beta.1 lib/dsu/services/entry/hydrator_service.rb
dsu-3.0.0.beta.0 lib/dsu/services/entry/hydrator_service.rb
dsu-3.0.0.alpha.12 lib/dsu/services/entry/hydrator_service.rb
dsu-3.0.0.alpha.11 lib/dsu/services/entry/hydrator_service.rb
dsu-3.0.0.alpha.10 lib/dsu/services/entry/hydrator_service.rb
dsu-3.0.0.alpha.9 lib/dsu/services/entry/hydrator_service.rb
dsu-3.0.0.alpha.8 lib/dsu/services/entry/hydrator_service.rb
dsu-3.0.0.alpha.7 lib/dsu/services/entry/hydrator_service.rb
dsu-3.0.0.alpha.6 lib/dsu/services/entry/hydrator_service.rb
dsu-3.0.0.alpha.5 lib/dsu/services/entry/hydrator_service.rb
dsu-3.0.0.alpha.4 lib/dsu/services/entry/hydrator_service.rb
dsu-3.0.0.alpha.3 lib/dsu/services/entry/hydrator_service.rb
dsu-3.0.0.alpha.2 lib/dsu/services/entry/hydrator_service.rb