Class: Ace::DSL
- Inherits:
-
Object
- Object
- Ace::DSL
- Defined in:
- lib/ace/dsl.rb
Instance Attribute Summary collapse
-
#generators ⇒ Object
Returns the value of attribute generators.
-
#rules ⇒ Object
Returns the value of attribute rules.
Instance Method Summary collapse
- #generator(klass) ⇒ Object
-
#initialize ⇒ DSL
constructor
A new instance of DSL.
- #rule(klass, *globs) ⇒ Object
Constructor Details
#initialize ⇒ DSL
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
#generators ⇒ Object
Returns the value of attribute generators.
5 6 7 |
# File 'lib/ace/dsl.rb', line 5 def generators @generators end |
#rules ⇒ Object
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 |