Class: ActiveRecord::Schema
- Inherits:
-
Object
- Object
- ActiveRecord::Schema
show all
- Defined in:
- lib/skeema/pretender.rb
Class Method Summary
collapse
Instance Method Summary
collapse
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(*args) ⇒ Object
9
10
11
|
# File 'lib/skeema/pretender.rb', line 9
def method_missing(*args)
end
|
Class Method Details
.add_table(table_name, columns) ⇒ Object
17
18
19
20
|
# File 'lib/skeema/pretender.rb', line 17
def self.add_table(table_name, columns)
@schema ||= {}
@schema[table_name] = columns
end
|
.define(*args, &block) ⇒ Object
13
14
15
|
# File 'lib/skeema/pretender.rb', line 13
def self.define(*args, &block)
new.instance_eval(&block)
end
|
.schema ⇒ Object
22
23
24
|
# File 'lib/skeema/pretender.rb', line 22
def self.schema
@schema || {}
end
|
Instance Method Details
#create_table(table_name, options = {}) {|table| ... } ⇒ Object
3
4
5
6
7
|
# File 'lib/skeema/pretender.rb', line 3
def create_table(table_name, options={}, &block)
table = Table.new(table_name)
yield table if block_given?
self.class.add_table(table.name, table.columns)
end
|