Class: Kayessess::Section

Inherits:
Node
  • Object
show all
Defined in:
lib/kayessess/section.rb

Overview

A wrapper around KSS section object

Instance Attribute Summary

Attributes inherited from Node

#children_hash, #id, #name, #parent, #sections_hash

Instance Method Summary collapse

Methods inherited from Node

#children, #parents, #sections, #to_param, #to_path

Constructor Details

#initialize(id, name, parent, section) ⇒ Section

Returns a new instance of Section.



8
9
10
11
12
# File 'lib/kayessess/section.rb', line 8

def initialize(id, name, parent, section)
  super(id, name, parent)

  @section = section
end

Instance Method Details

#descriptionObject



18
19
20
# File 'lib/kayessess/section.rb', line 18

def description
  @description ||= Kayessess.markdownerize(@section.description)
end

#example_partial_pathObject



35
36
37
38
# File 'lib/kayessess/section.rb', line 35

def example_partial_path
  reference_path = reference.split('.').map {|s| s.parameterize('_')}
  "styleguide/examples/#{File.join(reference_path)}"
end

#filenameObject



31
32
33
# File 'lib/kayessess/section.rb', line 31

def filename
  @section.filename
end

#is_section?Boolean

Returns:

  • (Boolean)


44
45
46
# File 'lib/kayessess/section.rb', line 44

def is_section?
  true
end

#modifiersObject



22
23
24
25
26
27
28
29
# File 'lib/kayessess/section.rb', line 22

def modifiers
  @modifiers ||= @section.modifiers.map {|modifier|
    if modifier.description
      modifier.description = Kayessess.markdownerize(modifier.description)
    end
    modifier
  }
end

#referenceObject



14
15
16
# File 'lib/kayessess/section.rb', line 14

def reference
  @section.section
end

#to_partial_pathObject



40
41
42
# File 'lib/kayessess/section.rb', line 40

def to_partial_path
  "section"
end