Sha256: cff64c34009ae25ceac2305f77d52beb3bc4893efe904582a1cb08abb5d2f4ae
Contents?: true
Size: 1013 Bytes
Versions: 1
Compression:
Stored size: 1013 Bytes
Contents
#!/usr/bin/env ruby # # Launches an irb session with an in-memory SQLite3 database and Node and Link # ActiveRecord models. # require 'rubygems' require 'activerecord' src = File.dirname(__FILE__) + '/../lib/dagnabit.rb' if File.exists?(src) require src else require 'dagnabit' end require 'irb' begin require 'sqlite3' rescue LoadError gem 'sqlite3-ruby' require 'sqlite3' end ActiveRecord::Base.logger = Logger.new("#{File.basename(__FILE__)}.log") ActiveRecord::Base.establish_connection(:adapter => 'sqlite3', :database => ':memory:') ActiveRecord::Schema.define do [:edges, :edges_transitive_closure_tuples].each do |table| create_table table do |t| t.integer :ancestor_id t.integer :descendant_id t.string :ancestor_type t.string :descendant_type end end create_table :nodes do |t| t.string :data end end class Edge < ActiveRecord::Base acts_as_dag_link end class Node < ActiveRecord::Base acts_as_dag_node_linked_by 'Edge' end IRB.start
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
dagnabit-2.2.1 | bin/dagnabit-test |