Class: Snatch::Session

Inherits:
Object
  • Object
show all
Defined in:
lib/snatch/session.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(config) ⇒ Session

Returns a new instance of Session.



9
10
11
12
13
14
# File 'lib/snatch/session.rb', line 9

def initialize(config)
  @config = config
  @config[:port] = config[:port] || 22
  @ssh = nil
  @filename = "#{@config[:host]}_#{Time.now.strftime("%Y%m%d%H%M%S")}.sql.gz"
end

Instance Attribute Details

#configObject (readonly)

Returns the value of attribute config.



7
8
9
# File 'lib/snatch/session.rb', line 7

def config
  @config
end

#filenameObject (readonly)

Returns the value of attribute filename.



7
8
9
# File 'lib/snatch/session.rb', line 7

def filename
  @filename
end

Instance Method Details

#run!Object



16
17
18
19
20
21
22
23
# File 'lib/snatch/session.rb', line 16

def run!
  connect
  test
  dump
  download
  cleanup
  disconnect
end