Class: ApidocToGFM::Views::Example

Inherits:
RspecApiDocumentation::Views::MarkdownExample
  • Object
show all
Includes:
Helpers
Defined in:
lib/apidoc_to_gfm/views/example.rb

Instance Method Summary collapse

Methods included from Helpers

#template_exists?, #template_path_from_gem

Constructor Details

#initialize(example, configuration) ⇒ Example



8
9
10
11
12
# File 'lib/apidoc_to_gfm/views/example.rb', line 8

def initialize(example, configuration)
  super
  self.template_name = "rspec_api_documentation/gfm_example"
  self.template_path = template_path_from_gem  unless template_exists?
end

Instance Method Details

#dirnameObject

Gitlab works only english filenames!



15
16
17
# File 'lib/apidoc_to_gfm/views/example.rb', line 15

def dirname
  transliterate(super).downcase
end

#extensionObject



31
32
33
# File 'lib/apidoc_to_gfm/views/example.rb', line 31

def extension
  @extension ||= 'md'.freeze
end

#filenameObject



19
20
21
# File 'lib/apidoc_to_gfm/views/example.rb', line 19

def filename
  transliterate(super).downcase
end

#parametersObject



23
24
25
26
27
28
29
# File 'lib/apidoc_to_gfm/views/example.rb', line 23

def parameters
  super.map do |parameter|
    parameter.merge({
      :required => parameter[:required] ? 'yes' : 'no',
    })
  end
end