Class: Rigrate::Driver
- Inherits:
-
Object
show all
- Defined in:
- lib/rigrate/interface/driver.rb
Instance Attribute Summary collapse
Instance Method Summary
collapse
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(mth, *args, &block) ⇒ Object
15
16
17
|
# File 'lib/rigrate/interface/driver.rb', line 15
def method_missing(mth, *args, &block)
@db.send(mth, *args, &block)
end
|
Instance Attribute Details
#db ⇒ Object
Returns the value of attribute db.
9
10
11
|
# File 'lib/rigrate/interface/driver.rb', line 9
def db
@db
end
|
Instance Method Details
#connect(db) ⇒ Object
11
12
13
|
# File 'lib/rigrate/interface/driver.rb', line 11
def connect(db)
self.db = db
end
|
19
20
21
22
23
24
25
26
27
28
29
|
# File 'lib/rigrate/interface/driver.rb', line 19
def (uri)
opts = {}
opts['db_type'] = uri.scheme if uri.scheme
opts['host'] = uri.host if uri.host
opts['username'] = uri.user if uri.user
opts['password'] = uri.password if uri.password
opts['port'] = uri.port if uri.port
opts['db_name'] = uri.path.tr('/','') if uri.path.tr('/','').size > 0
opts
end
|
35
36
37
38
39
|
# File 'lib/rigrate/interface/driver.rb', line 35
def (sql_str)
return $1 if sql_str =~ /from\s+(\w*)\s*/
raise Exception.new('a lastest one table name must specify.')
end
|
#to_native_row(row, column_info) ⇒ Object
31
32
33
|
# File 'lib/rigrate/interface/driver.rb', line 31
def to_native_row(row, column_info)
row
end
|