Class: JsonSerializer
- Inherits:
-
Object
- Object
- JsonSerializer
- Defined in:
- lib/json-serializer.rb
Defined Under Namespace
Modules: Utils
Instance Attribute Summary collapse
-
#object ⇒ Object
readonly
Returns the value of attribute object.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(object) ⇒ JsonSerializer
constructor
A new instance of JsonSerializer.
- #to_json(options = {}) ⇒ Object
Constructor Details
#initialize(object) ⇒ JsonSerializer
Returns a new instance of JsonSerializer.
14 15 16 |
# File 'lib/json-serializer.rb', line 14 def initialize(object) @object = object end |
Instance Attribute Details
#object ⇒ Object (readonly)
Returns the value of attribute object.
12 13 14 |
# File 'lib/json-serializer.rb', line 12 def object @object end |
Class Method Details
.attribute(name, serializer = nil) ⇒ Object
4 5 6 |
# File 'lib/json-serializer.rb', line 4 def self.attribute(name, serializer = nil) attributes[name] ||= serializer end |
.attributes ⇒ Object
8 9 10 |
# File 'lib/json-serializer.rb', line 8 def self.attributes @attributes ||= {} end |