Class: Yome::Section

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(chip) ⇒ Section

Returns a new instance of Section.



5
6
7
8
# File 'lib/yome/section.rb', line 5

def initialize(chip)
  @section = chip
  @texts = []
end

Instance Attribute Details

#sectionObject (readonly)

Returns the value of attribute section.



3
4
5
# File 'lib/yome/section.rb', line 3

def section
  @section
end

Instance Method Details

#add_text(chip) ⇒ Object



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

def add_text(chip)
  @texts << chip
end

#priorityObject



10
11
12
# File 'lib/yome/section.rb', line 10

def priority
  @section.priority
end

#result(parser, lang) ⇒ Object



18
19
20
21
22
23
24
25
26
27
# File 'lib/yome/section.rb', line 18

def result(parser, lang)
  <<EOS
## #{@section.content}
*#{@section.path}*

#{src_code(parser, @section, false, lang)}

#{@texts.map { |e| src_code(parser, e, true, lang) }.join("\n")}
EOS
end