Class: Dsu::Services::ColorTheme::HydratorService

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

Instance Method Summary collapse

Constructor Details

#initialize(theme_name:, theme_hash:, options: {}) ⇒ HydratorService

Returns a new instance of HydratorService.

Raises:

  • (ArgumentError)


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

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

  @theme_name = theme_name
  @theme_hash = theme_hash
  @options = options || {}
end

Instance Method Details

#callObject



22
23
24
# File 'lib/dsu/services/color_theme/hydrator_service.rb', line 22

def call
  Models::ColorTheme.new(theme_name: theme_name, theme_hash: hydrate)
end