Class: Bullet::Registry::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/bullet/registry/base.rb

Direct Known Subclasses

Association, Object

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeBase

Returns a new instance of Base.



6
7
8
# File 'lib/bullet/registry/base.rb', line 6

def initialize
  @registry = {}
end

Instance Attribute Details

#registryObject (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