module Arc::Tables
Public Class Methods
name(tablename:)
click to toggle source
returns the physicalID for the given table name
# File lib/architect/tables.rb, line 24 def self.name(tablename:) if ENV['NODE_ENV'] == 'testing' tmp = "staging-#{tablename}" db = Aws::DynamoDB::Resource.new :endpoint=> 'http://localhost:5000' tbl = db.tables().detect {|e| e.name.include?(tmp)} tbl.name else arc = Arc.reflect arc['tables'][tablename] end end
table(tablename:)
click to toggle source
returns Aws::DynamoDB::Table docs.aws.amazon.com/sdk-for-ruby/v3/api/Aws/DynamoDB/Table.html
# File lib/architect/tables.rb, line 12 def self.table(tablename:) ddb = if ENV['NODE_ENV'] == 'testing' Aws::DynamoDB::Resource.new :endpoint=> 'http://localhost:5000' else Aws::DynamoDB::Resource.new end ddb.table(Arc::Tables.name(tablename: tablename)) end