Class: Diaspora::EntityFinder

Inherits:
Object
  • Object
show all
Defined in:
lib/diaspora/entity_finder.rb

Instance Method Summary collapse

Constructor Details

#initialize(type, guid) ⇒ EntityFinder

Returns a new instance of EntityFinder.


5
6
7
8
# File 'lib/diaspora/entity_finder.rb', line 5

def initialize(type, guid)
  @type = type
  @guid = guid
end

Instance Method Details

#class_nameObject


10
11
12
# File 'lib/diaspora/entity_finder.rb', line 10

def class_name
  @class_name ||= DiasporaFederation::Entity.entity_class(type).to_s.rpartition("::").last
end

#findObject


14
15
16
# File 'lib/diaspora/entity_finder.rb', line 14

def find
  Diaspora::Federation::Mappings.model_class_for(class_name).find_by(guid: guid)
end