Class: Bullet::Registry::Association

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

Instance Attribute Summary

Attributes inherited from Base

#registry

Instance Method Summary collapse

Methods inherited from Base

#[], #add, #delete, #each, #initialize, #select

Constructor Details

This class inherits a constructor from Bullet::Registry::Base

Instance Method Details

#merge(base, associations) ⇒ Object



4
5
6
7
# File 'lib/bullet/registry/association.rb', line 4

def merge( base, associations )
  @registry.merge!( { base => associations } )
  unique( @registry[base] )
end

#similarly_associated(base, associations) ⇒ Object



9
10
11
12
13
# File 'lib/bullet/registry/association.rb', line 9

def similarly_associated( base, associations )
  @registry.select do |key, value|
    key.include?( base ) and value == associations
  end.collect( &:first ).flatten!
end