Class: GlobalID::Locator::BlockLocator
- Inherits:
-
Object
- Object
- GlobalID::Locator::BlockLocator
- Defined in:
- lib/global_id/locator.rb
Instance Method Summary collapse
-
#initialize(block) ⇒ BlockLocator
constructor
A new instance of BlockLocator.
- #locate(gid, options = {}) ⇒ Object
- #locate_many(gids, options = {}) ⇒ Object
- #model_class(gid) ⇒ Object
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, = {}) @locator.call(gid, ) end |
#locate_many(gids, options = {}) ⇒ Object
296 297 298 |
# File 'lib/global_id/locator.rb', line 296 def locate_many(gids, = {}) gids.map { |gid| locate(gid, ) } 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 |