Sha256: fe7844332d3e0b5bea610a4323c5f56aeab46114aea7dcb58933d52a32d91c54
Contents?: true
Size: 1.1 KB
Versions: 22
Compression:
Stored size: 1.1 KB
Contents
# frozen_string_literal: true require_relative '../../models/color_theme' module Dsu module Services module Project class HydratorService def initialize(project_hash:, options: {}) raise ArgumentError, 'project_hash is nil' if project_hash.nil? unless project_hash.is_a?(Hash) raise ArgumentError, "project_hash is the wrong object type: \"#{project_hash}\"" end raise ArgumentError, 'options is nil' if options.nil? raise ArgumentError, "options is the wrong object type:\"#{options}\"" unless options.is_a?(Hash) @project_hash = project_hash @options = options || {} end def call Models::Project.new(**hydrate) end private attr_reader :project_hash, :options # Not much going on here at all, but it's here for consistency. # Perform any pre-processing of the project_hash here (e.g. symbolize keys, # convert values to the correct type, etc.). def hydrate project_hash end end end end end
Version data entries
22 entries across 22 versions & 1 rubygems