Sha256: cf4a5a2731d1776a1cd8d5c3811125c174773bf02292b1ec886a9151fa69f9a8

Contents?: true

Size: 613 Bytes

Versions: 15

Compression:

Stored size: 613 Bytes

Contents

module Dyna
  class DSL
    class DynamoDB
      include Dyna::TemplateHelper

      attr_reader :result

      def initialize(context, tables, &block)
        @context = context
        @result = OpenStruct.new({
          :tables => tables,
        })

        instance_eval(&block)
      end

      private
      def table(name, &block)
        if table_names.include?(name)
          raise "Table `#{name}` is already defined"
        end

        @result.tables << Table.new(@context, name, &block).result
      end

      def table_names
        @result.tables.map(&:table_name)
      end
    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
dyna-0.2.3 lib/dyna/dsl/dynamo_db.rb
dyna-0.2.2 lib/dyna/dsl/dynamo_db.rb
dyna-0.2.1 lib/dyna/dsl/dynamo_db.rb
dyna-0.2.1.beta2 lib/dyna/dsl/dynamo_db.rb
dyna-0.2.1.beta1 lib/dyna/dsl/dynamo_db.rb
dyna-0.2.0 lib/dyna/dsl/dynamo_db.rb
dyna-0.1.9 lib/dyna/dsl/dynamo_db.rb
dyna-0.1.8 lib/dyna/dsl/dynamo_db.rb
dyna-0.1.7 lib/dyna/dsl/dynamo_db.rb
dyna-0.1.6 lib/dyna/dsl/dynamo_db.rb
dyna-0.1.5 lib/dyna/dsl/dynamo_db.rb
dyna-0.1.4 lib/dyna/dsl/dynamo_db.rb
dyna-0.1.3 lib/dyna/dsl/dynamo_db.rb
dyna-0.1.2 lib/dyna/dsl/dynamo_db.rb
dyna-0.1.1 lib/dyna/dsl/dynamo_db.rb