ace/lib/ace/dsl.rb
Jakub Šťastný aka Botanicus 4cc4e303ab Initial import
2010-10-20 14:42:17 +01:00

22 lines
468 B
Ruby

# encoding: utf-8
module Ace
class DSL
attr_accessor :rules, :generators
def initialize
@rules, @generators = Hash.new, Array.new
end
def rule(klass, *globs)
paths = globs.map { |glob| Dir.glob("content/#{glob}") }
files = paths.flatten.select { |path| File.file?(path) }
self.rules[klass] ||= Array.new
self.rules[klass].push(*files)
end
def generator(klass)
self.generators << klass
end
end
end