Module: ROM::Relation::ClassInterface
- Extended by:
- Notifications::Listener
- Included in:
- ROM::Relation
- Defined in:
- lib/rom/relation/class_interface.rb
Overview
Global class-level API for relation classes
Class Method Summary collapse
-
.subscribe(event_id, query = EMPTY_HASH, &block) ⇒ Object
extended
from Notifications::Listener
Subscribe to events.
Instance Method Summary collapse
-
#[](adapter) ⇒ Class
Return adapter-specific relation subclass.
- #curried ⇒ Object private
-
#forward(*methods) ⇒ Object
Dynamically define a method that will forward to the dataset and wrap response in the relation itself.
Class Method Details
.subscribe(event_id, query = EMPTY_HASH, &block) ⇒ Object Originally defined in module Notifications::Listener
Subscribe to events
Instance Method Details
#[](adapter) ⇒ Class
Return adapter-specific relation subclass
30 31 32 33 34 |
# File 'lib/rom/relation/class_interface.rb', line 30 def [](adapter) ROM.adapters.fetch(adapter).const_get(:Relation) rescue KeyError raise AdapterNotPresentError.new(adapter, :relation) end |
#curried ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
56 57 58 |
# File 'lib/rom/relation/class_interface.rb', line 56 def curried Curried end |
#forward(*methods) ⇒ Object
Dynamically define a method that will forward to the dataset and wrap response in the relation itself
45 46 47 48 49 50 51 52 53 |
# File 'lib/rom/relation/class_interface.rb', line 45 def forward(*methods) methods.each do |method| class_eval <<-RUBY, __FILE__, __LINE__ + 1 def #{method}(*args, &block) new(dataset.__send__(:#{method}, *args, &block)) end RUBY end end |