Class: ApiGuides::Views::Section

Inherits:
Object
  • Object
show all
Includes:
MarkdownHelper, ApiGuides::ViewHelper
Defined in:
lib/api_guides/views/section.rb

Instance Method Summary collapse

Methods included from ApiGuides::ViewHelper

#anchorize

Methods included from MarkdownHelper

#left_align, #markdown

Constructor Details

#initialize(section) ⇒ Section

Returns a new instance of Section.



9
10
11
# File 'lib/api_guides/views/section.rb', line 9

def initialize(section)
  @section = section
end

Instance Method Details

#docsObject



21
22
23
# File 'lib/api_guides/views/section.rb', line 21

def docs
  markdown @section.docs if @section.docs
end

#examplesObject



33
34
35
# File 'lib/api_guides/views/section.rb', line 33

def examples
  (@section.examples || []).map {|ex| Example.new ex }
end

#idObject



13
14
15
# File 'lib/api_guides/views/section.rb', line 13

def id
  anchorize "s-#{@section.title}"
end

#referenceObject



25
26
27
28
29
30
31
# File 'lib/api_guides/views/section.rb', line 25

def reference
  if @section.reference
    Reference.new @section.reference
  else
    nil
  end
end

#titleObject



17
18
19
# File 'lib/api_guides/views/section.rb', line 17

def title
  @section.title
end