Class: Yema::Registry::Rule

Inherits:
Object
  • Object
show all
Includes:
Enumerable
Defined in:
lib/yema/registry/rule.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeRule

Returns a new instance of Rule.



8
9
10
# File 'lib/yema/registry/rule.rb', line 8

def initialize
  @rules = Set.new
end

Instance Attribute Details

#rulesObject (readonly)

Returns the value of attribute rules.



6
7
8
# File 'lib/yema/registry/rule.rb', line 6

def rules
  @rules
end

Instance Method Details

#add(rule) ⇒ Object



12
13
14
# File 'lib/yema/registry/rule.rb', line 12

def add(rule)
  @rules << rule if rule
end

#eachObject



20
21
22
23
# File 'lib/yema/registry/rule.rb', line 20

def each
  return enum_for :each unless block_given?
  @rules.each{|rule| yield rule}
end

#merge(rule_set) ⇒ Object



16
17
18
# File 'lib/yema/registry/rule.rb', line 16

def merge(rule_set)
  @rules.merge(rule_set)
end