Class: ROM::Memory::Gateway
- Defined in:
- core/lib/rom/memory/gateway.rb
Overview
In-memory gateway interface
Instance Attribute Summary collapse
-
#logger ⇒ Object
readonly
Default logger.
Instance Method Summary collapse
-
#[](name) ⇒ Memory::Dataset
Return dataset with the given name.
-
#dataset(name) ⇒ Dataset
Register a dataset in the gateway.
- #dataset?(name) ⇒ Boolean
-
#use_logger(logger) ⇒ Object
Set default logger for the gateway.
Instance Attribute Details
#logger ⇒ Object (readonly)
Returns default logger.
23 24 25 |
# File 'core/lib/rom/memory/gateway.rb', line 23 def logger @logger end |
Instance Method Details
#[](name) ⇒ Memory::Dataset
Return dataset with the given name
61 62 63 |
# File 'core/lib/rom/memory/gateway.rb', line 61 def [](name) connection[name] end |
#dataset(name) ⇒ Dataset
Register a dataset in the gateway
If dataset already exists it will be returned
46 47 48 |
# File 'core/lib/rom/memory/gateway.rb', line 46 def dataset(name) self[name] || connection.create_dataset(name) end |
#dataset?(name) ⇒ Boolean
51 52 53 |
# File 'core/lib/rom/memory/gateway.rb', line 51 def dataset?(name) connection.key?(name) end |
#use_logger(logger) ⇒ Object
Set default logger for the gateway
35 36 37 |
# File 'core/lib/rom/memory/gateway.rb', line 35 def use_logger(logger) @logger = logger end |