Class: RubySerializer::Base
- Inherits:
-
Object
- Object
- RubySerializer::Base
- Extended by:
- Dsl
- Defined in:
- lib/ruby_serializer/base.rb
Instance Attribute Summary collapse
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Instance Method Summary collapse
- #as_json(options = {}) ⇒ Object
-
#initialize(resource) ⇒ Base
constructor
A new instance of Base.
Methods included from Dsl
belongs_to, expose, fields, has_many, has_one, serializes
Constructor Details
#initialize(resource) ⇒ Base
Returns a new instance of Base.
8 9 10 |
# File 'lib/ruby_serializer/base.rb', line 8 def initialize(resource) @resource = resource end |
Instance Attribute Details
#options ⇒ Object (readonly)
Returns the value of attribute options.
6 7 8 |
# File 'lib/ruby_serializer/base.rb', line 6 def @options end |
Instance Method Details
#as_json(options = {}) ⇒ Object
12 13 14 15 16 |
# File 'lib/ruby_serializer/base.rb', line 12 def as_json( = {}) json = serialize() json = { [:root] => json } if [:root] json end |