class Zeno::Makefile

Public Class Methods

new(path) click to toggle source
Calls superclass method Zeno::FileGenerator::new
# File lib/zeno/makefile.rb, line 23
def initialize(path)
  super
  @targets = Hash.new
end

Public Instance Methods

add_target(target, rules) click to toggle source
# File lib/zeno/makefile.rb, line 28
def add_target(target, rules)
  @targets[target] = rules
end
generate() click to toggle source
# File lib/zeno/makefile.rb, line 32
def generate
  File.open(@path, 'w') do |makefile|
    makefile.puts self.to_s
  end

  nil
end
to_s() click to toggle source
Calls superclass method Zeno::FileGenerator#to_s
# File lib/zeno/makefile.rb, line 40
def to_s
  output = super

  output += "\n"
  @targets.each do |key, value|
    output += "#{key}:\n"
    if value.is_a? Array
      value.each do |e|
        output += "\t#{e}\n"
      end
    else
      output += "\t#{value}\n"
    end

    output += "\n"
  end

  output
end