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

#docs ⇒ Object



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

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

#examples ⇒ Object



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

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

#id ⇒ Object



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

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

#reference ⇒ Object



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

#title ⇒ Object



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

def title
  @section.title
end