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 32 def call(env = {}) puts "Writing to: '#{filename}'" mkdir_p File.open(filename, "w") do |f| f.write(contents) end contents end
to_md(env)
click to toggle source
# File lib/rundoc/code_command/write.rb, line 25 def to_md(env) raise "must call write in its own code section" unless env[:commands].empty? before = env[:before] env[:before] = "In file `#{filename}` write:\n\n#{before}" nil end