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.
24 25 26 |
# File 'lib/json_serializer.rb', line 24 def initialize(object) @object = object end |
Instance Attribute Details
#object ⇒ Object (readonly)
Returns the value of attribute object.
22 23 24 |
# File 'lib/json_serializer.rb', line 22 def object @object end |
Class Method Details
.attribute(name, serializer = nil) ⇒ Object
14 15 16 |
# File 'lib/json_serializer.rb', line 14 def self.attribute(name, serializer = nil) attributes[name] ||= serializer end |
.attributes ⇒ Object
18 19 20 |
# File 'lib/json_serializer.rb', line 18 def self.attributes @attributes ||= {} end |