Sha256: ae71591db36bf398fe43c6aedd51957835d0576ff56a9001747b1a9f5048fb08

Contents?: true

Size: 1.02 KB

Versions: 48

Compression:

Stored size: 1.02 KB

Contents

# frozen_string_literal: true

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

          unless migration_version_hash.is_a?(Hash)
            raise ArgumentError,
              "migration_version_hash is the wrong object type: \"#{migration_version_hash}\""
          end
          raise ArgumentError, 'options is nil' if options.nil?
          raise ArgumentError, "options is the wrong object type:\"#{options}\"" unless options.is_a?(Hash)

          @migration_version_hash = migration_version_hash.dup
          @options = options || {}
        end

        def call
          hydrate
        end

        private

        attr_reader :migration_version_hash, :options

        def hydrate
          migration_version_hash[:version] = migration_version_hash[:version].to_i
          migration_version_hash
        end
      end
    end
  end
end

Version data entries

48 entries across 48 versions & 1 rubygems

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