Module: Betterdocs::Representer
- Extended by:
- ActiveSupport::Concern
- Included in:
- JsonParamsRepresenter, ResultRepresenter
- Defined in:
- lib/betterdocs/representer.rb
Defined Under Namespace
Modules: ClassMethods
Instance Method Summary collapse
Instance Method Details
#as_json ⇒ Object
6 7 8 9 10 |
# File 'lib/betterdocs/representer.rb', line 6 def as_json(*) singleton_class.ancestors.find do |c| c != singleton_class && c < Betterdocs::Representer end.hashify(self) end |
#to_json(*a) ⇒ Object
12 13 14 |
# File 'lib/betterdocs/representer.rb', line 12 def to_json(*a) JSON::generate(as_json, *a) end |