Module: OodCluster::JsonSerializer::ClassMethods

Defined in:
lib/ood_cluster/json_serializer.rb

Overview

Namespace for class methods that extend object

Instance Method Summary collapse

Instance Method Details

#json_create(object) ⇒ self

Initialize object with data attribute hash

Parameters:

  • object (Hash{#to_sym=>Object)

    ] hash used defining object

Returns:

  • (self)

    newly instantiated object



16
17
18
# File 'lib/ood_cluster/json_serializer.rb', line 16

def json_create(object)
  new object["data"].each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
end