Class: RubySerializer::Base
- Inherits:
-
Object
- Object
- RubySerializer::Base
- Extended by:
- Dsl
- Defined in:
- lib/ruby_serializer/base.rb
Instance Attribute Summary collapse
-
#include ⇒ Object
readonly
Returns the value of attribute include.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Instance Method Summary collapse
- #as_json(options = {}) ⇒ Object
-
#initialize(resource) ⇒ Base
constructor
only populated during #serialize and (temporarily) stores the #serialize options to make them available to any potential :value, :only and :unless lambdas in the derived serializer.
Methods included from Dsl
Constructor Details
#initialize(resource) ⇒ Base
only populated during #serialize and (temporarily) stores the #serialize options to make them available to any potential :value, :only and :unless lambdas in the derived serializer
9 10 11 |
# File 'lib/ruby_serializer/base.rb', line 9 def initialize(resource) @resource = resource end |
Instance Attribute Details
#include ⇒ Object (readonly)
Returns the value of attribute include.
6 7 8 |
# File 'lib/ruby_serializer/base.rb', line 6 def include @include end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
6 7 8 |
# File 'lib/ruby_serializer/base.rb', line 6 def end |
Instance Method Details
#as_json(options = {}) ⇒ Object
13 14 15 16 17 |
# File 'lib/ruby_serializer/base.rb', line 13 def as_json( = {}) json = serialize() json = { [:root] => json } if [:root] json end |