Sha256: 6f6b3aa012ad493d6d41657f6589b485c0484e19218e3e5a1ab47efe51e2c458

Contents?: true

Size: 1.26 KB

Versions: 2

Compression:

Stored size: 1.26 KB

Contents

require_relative '../include_use_case'

class IncludeTextAsComment < IncludeUseCase

  def self.build

    use_case = self.new

    includee_file_name = 'hello.rb'

    use_case.files_to_write.store(
        includee_file_name,
        <<EOT
class HelloWorld
   def initialize(name)
      @name = name.capitalize
   end
   def sayHi
      puts "Hello #{@name}!"
   end
end
EOT
    )

    use_case.files_to_write.store(
        INCLUDER_FILE_NAME,
        <<EOT
This file includes the code as a comment.

@[:comment](#{includee_file_name})

EOT
    )

    use_case.files_to_write.store(
        TEMPLATE_FILE_NAME,
        <<EOT
### Include Text As Comment

Use file inclusion to include text (or even code) as a comment.

#### File to Be Included

Here's a file containing code to be included:

@[markdown](#{includee_file_name})

#### Includer File

Here's a template file that includes it:

@[markdown](#{INCLUDER_FILE_NAME})

The treatment token ```:comment``` specifies that the included text is to be treated as a comment.

@[:markdown](../interface.md)

#### File with Inclusion

Here's the finished file with the included comment:

@[markdown](#{INCLUDED_FILE_NAME})

EOT
    )

    use_case.build

  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
markdown_helper-2.2.0 markdown/use_cases/include_files/include_text_as_comment/use_case_builder.rb
markdown_helper-2.1.0 markdown/use_cases/include_files/include_text_as_comment/use_case_builder.rb