Sha256: 4b63b1abdce7f17a1d69a8275141614fd2bf890762ca4811518204759783c500

Contents?: true

Size: 556 Bytes

Versions: 5

Compression:

Stored size: 556 Bytes

Contents

# frozen_string_literal: true

require "aws-sdk-dynamodb"

module Dynamodb
  module Connection
    def client(new_connection = nil)
      return (@@client = new_connection) unless new_connection.nil?

      @@client ||= Aws::DynamoDB::Client.new(Dynamodb.configuration.client_config)
    end

    def resource(new_resource = nil)
      return (@@resource = new_resource) unless new_resource.nil?

      @@resource ||= Aws::DynamoDB::Resource.new(client: client)
    end

    def reset_client
      @@client   = nil
      @@resource = nil
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
dynamodb-ruby-0.6.0 lib/dynamodb/connection.rb
dynamodb-ruby-0.5.2 lib/dynamodb/connection.rb
dynamodb-ruby-0.5.1 lib/dynamodb/connection.rb
dynamodb-ruby-0.5.0 lib/dynamodb/connection.rb
dynamodb-ruby-0.4.0 lib/dynamodb/connection.rb