Class: Forklift::Base::Connection
- Inherits:
-
Object
- Object
- Forklift::Base::Connection
show all
- Defined in:
- lib/forklift/base/connection.rb
Instance Method Summary
collapse
Constructor Details
#initialize(config) ⇒ Connection
Returns a new instance of Connection.
5
6
7
|
# File 'lib/forklift/base/connection.rb', line 5
def initialize(config)
@config = config
end
|
Instance Method Details
#client ⇒ Object
13
14
15
|
# File 'lib/forklift/base/connection.rb', line 13
def client
@client
end
|
#config ⇒ Object
9
10
11
|
# File 'lib/forklift/base/connection.rb', line 9
def config
@config
end
|
#connect ⇒ Object
17
18
19
20
|
# File 'lib/forklift/base/connection.rb', line 17
def connect
raise 'not implemented'
end
|
#disconnect ⇒ Object
22
23
24
|
# File 'lib/forklift/base/connection.rb', line 22
def disconnect
raise 'not implemented'
end
|
#exec(path, *args) ⇒ Object
41
42
43
44
45
46
47
|
# File 'lib/forklift/base/connection.rb', line 41
def exec(path, *args)
begin
exec!(path, &args)
rescue Exception => e
forklift.logger.log(e)
end
end
|
#exec!(path, *args) ⇒ Object
49
50
51
52
53
54
55
56
57
|
# File 'lib/forklift/base/connection.rb', line 49
def exec!(path, *args)
forklift.logger.log "Running script: #{path}"
extension = path.split(".").last
if(extension == "rb" || extension == "ruby")
exec_ruby(path, *args)
else
exec_script(path, *args)
end
end
|
#exec_ruby(path, *args) ⇒ Object
59
60
61
62
63
64
|
# File 'lib/forklift/base/connection.rb', line 59
def exec_ruby(path, *args)
klass = forklift.utils.class_name_from_file(path)
require path
model = eval("#{klass}.new")
model.do!(self, forklift, *args)
end
|
#exec_script(path, *args) ⇒ Object
66
67
68
|
# File 'lib/forklift/base/connection.rb', line 66
def exec_script(path, *args)
raise 'not implemented'
end
|
#pipe ⇒ Object
36
37
38
39
|
# File 'lib/forklift/base/connection.rb', line 36
def pipe
raise 'not implemented'
end
|
#read(query) ⇒ Object
26
27
28
29
|
# File 'lib/forklift/base/connection.rb', line 26
def read(query)
raise 'not implemented'
end
|
#write(data, collection) ⇒ Object
31
32
33
34
|
# File 'lib/forklift/base/connection.rb', line 31
def write(data, collection)
raise 'not implemented'
end
|