Class: GDK::ConfigType::Hash

Inherits:
Base
  • Object
show all
Includes:
Mergable
Defined in:
lib/gdk/config_type/hash.rb

Instance Attribute Summary

Attributes included from Mergable

#merge

Attributes inherited from Base

#builder, #parent, #user_value, #value

Instance Method Summary collapse

Methods included from Mergable

#initialize, #read_value

Methods inherited from Base

#default_value, #dump!, #initialize, #root, #slug, #user_defined?, #validate!

Instance Method Details

#parse(value) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
# File 'lib/gdk/config_type/hash.rb', line 10

def parse(value)
  if value.is_a?(::String)
    begin
      return JSON.parse(value)
    rescue JSON::ParserError => e
      raise StandardErrorWithMessage, e.message
    end
  end

  value.to_h
end