Module: DigitalOpera::Presenter::JsonSerialization
- Extended by:
- ActiveSupport::Concern
- Included in:
- Base
- Defined in:
- lib/digital_opera/presenter/concerns/json_serialization.rb
Defined Under Namespace
Modules: ClassMethods
Instance Method Summary collapse
Instance Method Details
#as_json(opts = {}) ⇒ Object
8 9 10 |
# File 'lib/digital_opera/presenter/concerns/json_serialization.rb', line 8 def as_json(opts={}) super(opts).merge( self.get_json_field_hash ) end |
#get_json_field_hash ⇒ Object
12 13 14 15 16 17 18 19 20 |
# File 'lib/digital_opera/presenter/concerns/json_serialization.rb', line 12 def get_json_field_hash json_field_hash = {} self.class.include_in_json.each do |method_name| json_field_hash[method_name.to_sym] = self.send(method_name) end json_field_hash end |