lib/pessimize/dsl.rb in pessimize-0.0.2 vs lib/pessimize/dsl.rb in pessimize-0.0.3

- old
+ new

@@ -1,36 +1,39 @@ module Pessimize class DSL def initialize(collector) @collector = collector - @current_group = nil + @current_groups = nil end def parse(definition) - instance_eval definition + instance_eval definition, __FILE__, __LINE__ end def method_missing(name, *args) collector.add_declaration(name.to_s, *args) end protected attr_reader :collector - attr_accessor :current_group + attr_accessor :current_groups def gem(*args) - if current_group - collector.add_grouped_gem(current_group, *args) + if current_groups + current_groups.each do |group| + collector.add_grouped_gem(group, *args) + end else collector.add_gem(*args) end end - def group(name) + def group(group, *others) + groups = [group].flatten + others if block_given? - self.current_group = name + self.current_groups = groups yield - self.current_group = nil + self.current_groups = nil end end end end