Sha256: 24b5a736861be5827049d4359518c6007837afe0011c5363cbfa7c9fdaead344

Contents?: true

Size: 506 Bytes

Versions: 1

Compression:

Stored size: 506 Bytes

Contents

require 'data_mapper/mappings/table'
    
module DataMapper
  module Mappings
    
    class Schema
    
      def initialize(database)
        @database = database
        @tables = Hash.new { |h,k| h[k] = Table.new(@database, k) }
      end
    
      def [](klass)
        @tables[klass]
      rescue
        raise "#{klass.inspect} can't be mapped to a table"
      end
      
      def each
        @tables.values.each do |table|
          yield table
        end
      end
    
    end
    
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
datamapper-0.1.0 lib/data_mapper/mappings/schema.rb