Class: Bowndler::ExecAtExit

Inherits:
Object
  • Object
show all
Defined in:
lib/bowndler/exec_at_exit.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(command, working_dir) ⇒ ExecAtExit

Returns a new instance of ExecAtExit.



13
14
15
16
# File 'lib/bowndler/exec_at_exit.rb', line 13

def initialize(command, working_dir)
  @command = command.to_s
  @working_dir = working_dir
end

Instance Attribute Details

#commandObject (readonly)

Returns the value of attribute command.



11
12
13
# File 'lib/bowndler/exec_at_exit.rb', line 11

def command
  @command
end

#working_dirObject (readonly)

Returns the value of attribute working_dir.



11
12
13
# File 'lib/bowndler/exec_at_exit.rb', line 11

def working_dir
  @working_dir
end

Class Method Details

.register(*args) ⇒ Object



5
6
7
8
# File 'lib/bowndler/exec_at_exit.rb', line 5

def register(*args)
  $stderr.puts "exec_at_exit: #{args}"
  at_exit { new(*args).run }
end

Instance Method Details

#runObject



18
19
20
# File 'lib/bowndler/exec_at_exit.rb', line 18

def run
  run_command if is_exiting_cleanly?
end