Class: Dsu::Services::Project::HydratorService

Inherits:
Object
  • Object
show all
Defined in:
lib/dsu/services/project/hydrator_service.rb

Instance Method Summary collapse

Constructor Details

#initialize(project_hash:, options: {}) ⇒ HydratorService

Returns a new instance of HydratorService.

Raises:

  • (ArgumentError)


9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/dsu/services/project/hydrator_service.rb', line 9

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

Instance Method Details

#callObject



23
24
25
# File 'lib/dsu/services/project/hydrator_service.rb', line 23

def call
  Models::Project.new(**hydrate)
end