Class: Pakyow::Data::Lookup
- Inherits:
-
Object
- Object
- Pakyow::Data::Lookup
- Defined in:
- lib/pakyow/data/lookup.rb
Instance Attribute Summary collapse
- #containers ⇒ Object readonly private
- #sources ⇒ Object readonly private
- #subscribers ⇒ Object readonly private
Instance Method Summary collapse
- #ephemeral(type, **qualifications) ⇒ Object
- #expire(subscriber, seconds) ⇒ Object
-
#initialize(containers:, subscribers:, app:) ⇒ Lookup
constructor
A new instance of Lookup.
- #persist(subscriber) ⇒ Object
- #unsubscribe(subscriber) ⇒ Object
Constructor Details
#initialize(containers:, subscribers:, app:) ⇒ Lookup
Returns a new instance of Lookup.
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/pakyow/data/lookup.rb', line 13 def initialize(containers:, subscribers:, app:) @subscribers = subscribers @subscribers.lookup = self @app = app @sources = {} @containers = containers @containers.each do |container| container.sources.each do |source| @sources[source.__object_name.name] = source define_singleton_method source.__object_name.name do Proxy.new( container.source( source.__object_name.name ), @subscribers, @app ) end end end validate! end |
Instance Attribute Details
#containers ⇒ Object (readonly)
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.
11 12 13 |
# File 'lib/pakyow/data/lookup.rb', line 11 def containers @containers end |
#sources ⇒ Object (readonly)
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.
11 12 13 |
# File 'lib/pakyow/data/lookup.rb', line 11 def sources @sources end |
#subscribers ⇒ Object (readonly)
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.
11 12 13 |
# File 'lib/pakyow/data/lookup.rb', line 11 def subscribers @subscribers end |
Instance Method Details
#ephemeral(type, **qualifications) ⇒ Object
38 39 40 41 42 43 |
# File 'lib/pakyow/data/lookup.rb', line 38 def ephemeral(type, **qualifications) Proxy.new( Sources::Ephemeral.new(type, **qualifications), @subscribers, @app ) end |
#expire(subscriber, seconds) ⇒ Object
49 50 51 |
# File 'lib/pakyow/data/lookup.rb', line 49 def expire(subscriber, seconds) @subscribers.expire(subscriber, seconds) end |
#persist(subscriber) ⇒ Object
53 54 55 |
# File 'lib/pakyow/data/lookup.rb', line 53 def persist(subscriber) @subscribers.persist(subscriber) end |
#unsubscribe(subscriber) ⇒ Object
45 46 47 |
# File 'lib/pakyow/data/lookup.rb', line 45 def unsubscribe(subscriber) @subscribers.unsubscribe(subscriber) end |