class Rundoc::CodeCommand::Write
Public Class Methods
Source
# File lib/rundoc/code_command/write.rb, line 21 def initialize(filename) @filename = filename end
Public Instance Methods
Source
# File lib/rundoc/code_command/write.rb, line 36 def call(env = {}) puts "Writing to: '#{filename}'" mkdir_p File.write(filename, contents) contents end
Source
# File lib/rundoc/code_command/write.rb, line 25 def to_md(env) if render_command? if env[:commands].any? { |c| c[:object].not_hidden? } raise "must call write in its own code section" end env[:before] << "In file `#{filename}` write:" env[:before] << NEWLINE end nil end