Sha256: 2835a550374b80fdad5f8882d2c69f4bf5ed3445078a8afc2e9cacc3a155be3d
Contents?: true
Size: 1.42 KB
Versions: 3
Compression:
Stored size: 1.42 KB
Contents
require_relative '../include_use_case' class IncludeCodeBlock < IncludeUseCase def self.build use_case_name = File.basename(__FILE__, '.rb') use_case = self.new(use_case_name) 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 code block. @[:code_block](#{includee_file_name}) EOT ) use_case.files_to_write.store( TEMPLATE_FILE_NAME, <<EOT ### Include Code Block Use file inclusion to include text as a code block. #### 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 ```:code_block``` specifies that the included text is to be treated as a code block. @[:markdown](../interface.md) #### File with Inclusion Here's the finished file with the included code block: @[:pre](#{INCLUDED_FILE_NAME}) And here's the finished markdown, as rendered on this page: --- @[:markdown](#{INCLUDED_FILE_NAME}) --- EOT ) use_case.build end end
Version data entries
3 entries across 3 versions & 1 rubygems