Class: ROM::HTTP::Gateway
- Inherits:
-
Gateway
- Object
- Gateway
- ROM::HTTP::Gateway
- Defined in:
- lib/rom/http/gateway.rb
Overview
HTTP gateway
Instance Attribute Summary collapse
- #config ⇒ Object readonly
- #datasets ⇒ Object readonly
Instance Method Summary collapse
-
#[](name) ⇒ Dataset
Retrieve dataset with the given name.
-
#dataset(name) ⇒ Dataset
Build dataset with the given name.
-
#dataset?(name) ⇒ Boolean
Check if dataset exists.
-
#initialize(config) ⇒ Gateway
constructor
HTTP gateway interface.
Constructor Details
#initialize(config) ⇒ Gateway
HTTP gateway interface
37 38 39 40 |
# File 'lib/rom/http/gateway.rb', line 37 def initialize(config) @datasets = Concurrent::Map.new @config = config end |
Instance Attribute Details
#config ⇒ Object (readonly)
26 27 28 |
# File 'lib/rom/http/gateway.rb', line 26 def config @config end |
#datasets ⇒ Object (readonly)
26 27 28 |
# File 'lib/rom/http/gateway.rb', line 26 def datasets @datasets end |
Instance Method Details
#[](name) ⇒ Dataset
Retrieve dataset with the given name
49 50 51 |
# File 'lib/rom/http/gateway.rb', line 49 def [](name) datasets.fetch(name) end |
#dataset(name) ⇒ Dataset
Build dataset with the given name
60 61 62 |
# File 'lib/rom/http/gateway.rb', line 60 def dataset(name) datasets[name] = dataset_class.new((name)) end |
#dataset?(name) ⇒ Boolean
Check if dataset exists
69 70 71 |
# File 'lib/rom/http/gateway.rb', line 69 def dataset?(name) datasets.key?(name) end |