Class: Bullet::Registry::Base
- Inherits:
-
Object
- Object
- Bullet::Registry::Base
- Defined in:
- lib/bullet/registry/base.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#registry ⇒ Object
readonly
Returns the value of attribute registry.
Instance Method Summary collapse
- #[](key) ⇒ Object
- #add(key, value) ⇒ Object
- #delete(base) ⇒ Object
- #each(&block) ⇒ Object
-
#initialize ⇒ Base
constructor
A new instance of Base.
- #select(*args, &block) ⇒ Object
Constructor Details
#initialize ⇒ Base
Returns a new instance of Base.
6 7 8 |
# File 'lib/bullet/registry/base.rb', line 6 def initialize @registry = {} end |
Instance Attribute Details
#registry ⇒ Object (readonly)
Returns the value of attribute registry.
4 5 6 |
# File 'lib/bullet/registry/base.rb', line 4 def registry @registry end |
Instance Method Details
#[](key) ⇒ Object
10 11 12 |
# File 'lib/bullet/registry/base.rb', line 10 def [](key) @registry[key] end |
#add(key, value) ⇒ Object
26 27 28 29 30 |
# File 'lib/bullet/registry/base.rb', line 26 def add( key, value ) @registry[key] ||= [] @registry[key] << value unique( @registry[key] ) end |
#delete(base) ⇒ Object
18 19 20 |
# File 'lib/bullet/registry/base.rb', line 18 def delete( base ) @registry.delete( base ) end |
#each(&block) ⇒ Object
14 15 16 |
# File 'lib/bullet/registry/base.rb', line 14 def each( &block ) @registry.each( &block ) end |
#select(*args, &block) ⇒ Object
22 23 24 |
# File 'lib/bullet/registry/base.rb', line 22 def select( *args, &block ) @registry.select( *args, &block ) end |