Class: Source2MD::Generator

Inherits:
Object
  • Object
show all
Defined in:
lib/source2md/generator.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(params = {}) ⇒ Generator

Returns a new instance of Generator.



5
6
7
# File 'lib/source2md/generator.rb', line 5

def initialize(params = {})
  @params = params
end

Instance Attribute Details

#paramsObject

Returns the value of attribute params.



3
4
5
# File 'lib/source2md/generator.rb', line 3

def params
  @params
end

Instance Method Details

#callObject



9
10
11
12
# File 'lib/source2md/generator.rb', line 9

def call
  output_file.write(to_md)
  puts "write: #{output_file}"
end

#to_mdObject



14
15
16
17
18
# File 'lib/source2md/generator.rb', line 14

def to_md
  s = sections.collect(&:to_md) * "\n\n"
  s = TextHelper.blank_lines_squish(s)
  s = TextHelper.add_newline_at_end_of_text(s)
end