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