Class: Yema::Registry::Rule
- Inherits:
-
Object
- Object
- Yema::Registry::Rule
- Includes:
- Enumerable
- Defined in:
- lib/yema/registry/rule.rb
Instance Attribute Summary collapse
-
#rules ⇒ Object
readonly
Returns the value of attribute rules.
Instance Method Summary collapse
- #add(rule) ⇒ Object
- #each ⇒ Object
-
#initialize ⇒ Rule
constructor
A new instance of Rule.
- #merge(rule_set) ⇒ Object
Constructor Details
#initialize ⇒ Rule
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
#rules ⇒ Object (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 |
#each ⇒ Object
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 |