lib/rbrules.rb in rbrules-0.1.0 vs lib/rbrules.rb in rbrules-0.1.1
- old
+ new
@@ -2,9 +2,20 @@
attr_reader :rules
@rule_sets = Hash.new { |hash, key| hash[key] = new }
+ def +(other)
+ self.class.new do |builder|
+ rules.each { |rule| builder.rule(rule) }
+ if other.is_a?(self.class)
+ other.rules.each { |rule| builder.rule(rule) }
+ else
+ builder.rule(other)
+ end
+ end
+ end
+
def self.[](key)
@rule_sets[key]
end
def initialize(&block)