Class: RspecApiDocs::Renderer::RaddocsRenderer::IndexSerializer::ExampleSerializer

Inherits:
Object
  • Object
show all
Defined in:
lib/rspec_api_docs/formatter/renderer/raddocs_renderer/index_serializer.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(example, resource_name) ⇒ ExampleSerializer


11
12
13
14
# File 'lib/rspec_api_docs/formatter/renderer/raddocs_renderer/index_serializer.rb', line 11

def initialize(example, resource_name)
  @example = example
  @resource_name = resource_name
end

Instance Attribute Details

#exampleObject (readonly)

Returns the value of attribute example


9
10
11
# File 'lib/rspec_api_docs/formatter/renderer/raddocs_renderer/index_serializer.rb', line 9

def example
  @example
end

#resource_nameObject (readonly)

Returns the value of attribute resource_name


9
10
11
# File 'lib/rspec_api_docs/formatter/renderer/raddocs_renderer/index_serializer.rb', line 9

def resource_name
  @resource_name
end

Instance Method Details

#to_hObject


16
17
18
19
20
21
22
23
24
# File 'lib/rspec_api_docs/formatter/renderer/raddocs_renderer/index_serializer.rb', line 16

def to_h
  {
    description: example.name,
    link: link,
    groups: groups,
    route: example.path,
    method: example.http_method.downcase,
  }
end