Class: RspecApiDocs::Renderer::JSONRenderer::ResourceSerializer

Inherits:
Object
  • Object
show all
Defined in:
lib/rspec_api_docs/formatter/renderer/json_renderer/resource_serializer.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(resource) ⇒ ResourceSerializer


9
10
11
# File 'lib/rspec_api_docs/formatter/renderer/json_renderer/resource_serializer.rb', line 9

def initialize(resource)
  @resource = resource
end

Instance Attribute Details

#resourceObject (readonly)

Returns the value of attribute resource


7
8
9
# File 'lib/rspec_api_docs/formatter/renderer/json_renderer/resource_serializer.rb', line 7

def resource
  @resource
end

Instance Method Details

#to_hObject


13
14
15
16
17
18
19
# File 'lib/rspec_api_docs/formatter/renderer/json_renderer/resource_serializer.rb', line 13

def to_h
  {
    name: resource.name,
    description: resource.description,
    examples: examples,
  }
end