Class: GlobalID::Locator::BlockLocator

Inherits:
Object
  • Object
show all
Defined in:
lib/global_id/locator.rb

Instance Method Summary collapse

Constructor Details

#initialize(block) ⇒ BlockLocator

Returns a new instance of BlockLocator.



284
285
286
# File 'lib/global_id/locator.rb', line 284

def initialize(block)
  @locator = block
end

Instance Method Details

#locate(gid, options = {}) ⇒ Object



292
293
294
# File 'lib/global_id/locator.rb', line 292

def locate(gid, options = {})
  @locator.call(gid, options)
end

#locate_many(gids, options = {}) ⇒ Object



296
297
298
# File 'lib/global_id/locator.rb', line 296

def locate_many(gids, options = {})
  gids.map { |gid| locate(gid, options) }
end

#model_class(gid) ⇒ Object



288
289
290
# File 'lib/global_id/locator.rb', line 288

def model_class(gid)
  gid.model_name.constantize
end