Class: Ace::DSL

Inherits:
Object
  • Object
show all
Defined in:
lib/ace/dsl.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeDSL

Returns a new instance of DSL.



6
7
8
# File 'lib/ace/dsl.rb', line 6

def initialize
  @rules, @generators = Hash.new, Array.new
end

Instance Attribute Details

#generatorsObject

Returns the value of attribute generators.



5
6
7
# File 'lib/ace/dsl.rb', line 5

def generators
  @generators
end

#rulesObject

Returns the value of attribute rules.



5
6
7
# File 'lib/ace/dsl.rb', line 5

def rules
  @rules
end

Instance Method Details

#generator(klass) ⇒ Object



17
18
19
# File 'lib/ace/dsl.rb', line 17

def generator(klass)
  self.generators << klass
end

#rule(klass, *globs) ⇒ Object



10
11
12
13
14
15
# File 'lib/ace/dsl.rb', line 10

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