Class: Source2MD::Generator
- Inherits:
-
Object
- Object
- Source2MD::Generator
- Defined in:
- lib/source2md/generator.rb
Instance Attribute Summary collapse
-
#params ⇒ Object
Returns the value of attribute params.
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(params = {}) ⇒ Generator
constructor
A new instance of Generator.
- #to_md ⇒ Object
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
#params ⇒ Object
Returns the value of attribute params.
3 4 5 |
# File 'lib/source2md/generator.rb', line 3 def params @params end |
Instance Method Details
#call ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/source2md/generator.rb', line 9 def call if !output_file puts to_md end if output_file temporarily_disable_write_protection do output_file.write(to_md) puts "write: #{output_file}" end end end |
#to_md ⇒ Object
22 23 24 25 26 |
# File 'lib/source2md/generator.rb', line 22 def to_md s = sections.collect(&:to_md) * "\n\n" s = TextHelper.blank_lines_squish(s) s = TextHelper.eol_enter(s) end |