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_jsonObject Also known as: to_hash



7
8
9
10
11
# File 'lib/betterdocs/representer.rb', line 7

def as_json(*)
  singleton_class.ancestors.find do |c|
    c != singleton_class && c < Betterdocs::Representer
  end.hashify(self)
end

#to_json(*a) ⇒ Object



15
16
17
# File 'lib/betterdocs/representer.rb', line 15

def to_json(*a)
  JSON::generate(as_json, *a)
end