Class: MrMurano::Hooked

Inherits:
Object
  • Object
show all
Includes:
Verbose
Defined in:
lib/MrMurano/ReCommander.rb

Constant Summary

Constants included from Verbose

Verbose::TABULARIZE_DATA_FORMAT_ERROR

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Verbose

ask_yes_no, #ask_yes_no, #assert, assert, cmd_confirm_delete!, #cmd_confirm_delete!, debug, #debug, dump_file_json, dump_file_plain, dump_file_yaml, #dump_output_file, #error, error, #error_file_format!, fancy_ticks, #fancy_ticks, #load_file_json, #load_file_plain, #load_file_yaml, #load_input_file, outf, #outf, #outformat_engine, #pluralize?, pluralize?, #prepare_hash_csv, #read_hashf!, #tabularize, tabularize, verbose, #verbose, warning, #warning, #whirly_interject, whirly_interject, #whirly_linger, whirly_linger, #whirly_msg, whirly_msg, #whirly_pause, whirly_pause, #whirly_start, whirly_start, #whirly_stop, whirly_stop, #whirly_unpause, whirly_unpause

Constructor Details

#initialize(section) ⇒ Hooked

Returns a new instance of Hooked.



17
18
19
# File 'lib/MrMurano/ReCommander.rb', line 17

def initialize(section)
  @section = section
end

Instance Attribute Details

#sectionObject (readonly)

Returns the value of attribute section.



21
22
23
# File 'lib/MrMurano/ReCommander.rb', line 21

def section
  @section
end

Instance Method Details

#check_run_post_hookObject



31
32
33
34
35
36
37
# File 'lib/MrMurano/ReCommander.rb', line 31

def check_run_post_hook
  posthook = $cfg["#{section}.post-hook"]
  return if posthook.nil?
  return if posthook.empty?
  verbose "calling post-hook: #{posthook}"
  system(posthook)
end

#check_run_pre_hookObject



23
24
25
26
27
28
29
# File 'lib/MrMurano/ReCommander.rb', line 23

def check_run_pre_hook
  prehook = $cfg["#{section}.pre-hook"]
  return if prehook.nil?
  return if prehook.empty?
  verbose "calling pre-hook: #{prehook}"
  system(prehook)
end