Class: JsonObject::JsonOpenStruct

Inherits:
OpenStruct
  • Object
show all
Includes:
JsonObject
Defined in:
lib/json_object.rb

Overview

A sane default class for use by ClassMethods#object_accessor when a custom class is not provided.

Simply an OpenStruct object with our JsonObject module included.

Constant Summary

Constants included from JsonObject

VERSION

Instance Attribute Summary

Attributes included from JsonObject

#json_hash, #parent

Class Method Summary collapse

Methods included from JsonObject

default_json_object_class, default_json_object_class=, included

Class Method Details

.create(hash, parent = nil) ⇒ Object

Making sure we set our json_* attributes otherwise



61
62
63
64
65
66
# File 'lib/json_object.rb', line 61

def self.create hash, parent=nil
  new(hash).tap do |obj|
    obj.parent = parent
    obj.json_hash = hash
  end
end