Class: ROM::DynamoDB::Gateway
- Inherits:
-
Gateway
- Object
- Gateway
- ROM::DynamoDB::Gateway
- Defined in:
- lib/rom/dynamodb/gateway.rb
Instance Attribute Summary collapse
-
#config ⇒ Object
readonly
Returns the value of attribute config.
-
#datasets ⇒ Object
readonly
Returns the value of attribute datasets.
Instance Method Summary collapse
- #connection ⇒ Object
- #dataset(name) ⇒ Object
- #dataset?(name) ⇒ Boolean
-
#initialize(config = {}) ⇒ Gateway
constructor
A new instance of Gateway.
Constructor Details
#initialize(config = {}) ⇒ Gateway
Returns a new instance of Gateway.
6 7 8 9 |
# File 'lib/rom/dynamodb/gateway.rb', line 6 def initialize(config = {}) @config = config @datasets ||= {} end |
Instance Attribute Details
#config ⇒ Object (readonly)
Returns the value of attribute config.
4 5 6 |
# File 'lib/rom/dynamodb/gateway.rb', line 4 def config @config end |
#datasets ⇒ Object (readonly)
Returns the value of attribute datasets.
4 5 6 |
# File 'lib/rom/dynamodb/gateway.rb', line 4 def datasets @datasets end |
Instance Method Details
#connection ⇒ Object
20 21 22 |
# File 'lib/rom/dynamodb/gateway.rb', line 20 def connection @connection ||= Aws::DynamoDB::Client.new(@config) end |
#dataset(name) ⇒ Object
11 12 13 |
# File 'lib/rom/dynamodb/gateway.rb', line 11 def dataset(name) datasets[name] ||= Dataset.new(name: name, config: config) end |
#dataset?(name) ⇒ Boolean
15 16 17 18 |
# File 'lib/rom/dynamodb/gateway.rb', line 15 def dataset?(name) list = connection.list_tables list.table_names.include?(name) end |