class Zeno::FileGenerator
Attributes
path[R]
vars[R]
Public Class Methods
new(path)
click to toggle source
# File lib/zeno/filegenerator.rb, line 26 def initialize(path) @path = path @vars = Hash.new end
Public Instance Methods
add_var(name, value, assign = '=')
click to toggle source
# File lib/zeno/filegenerator.rb, line 31 def add_var(name, value, assign = '=') @vars[name] = "#{assign} #{value}" end
del_var(name)
click to toggle source
# File lib/zeno/filegenerator.rb, line 35 def del_var(name) @vars.delete name end
generate()
click to toggle source
# File lib/zeno/filegenerator.rb, line 39 def generate File.open(path, 'w') do |file| file.puts self.to_s end nil end
to_s()
click to toggle source
# File lib/zeno/filegenerator.rb, line 47 def to_s output = "" @vars.each do |key, value| output += "#{key} #{value}\n" end output end