Class: Yast::HooksClass

Inherits:
Module
  • Object
show all
Includes:
Logger
Defined in:
library/general/src/modules/Hooks.rb

Defined Under Namespace

Classes: Hook, HookFile, SearchPath

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeHooksClass

Returns a new instance of HooksClass.


70
71
72
73
74
# File 'library/general/src/modules/Hooks.rb', line 70

def initialize
  textdomain "base"
  @hooks = {}
  @search_path = SearchPath.new
end

Instance Attribute Details

#lastObject (readonly)

Returns the value of attribute last


66
67
68
# File 'library/general/src/modules/Hooks.rb', line 66

def last
  @last
end

#search_pathObject (readonly)

Returns the value of attribute search_path


66
67
68
# File 'library/general/src/modules/Hooks.rb', line 66

def search_path
  @search_path
end

Instance Method Details

#allObject


89
90
91
# File 'library/general/src/modules/Hooks.rb', line 89

def all
  hooks.values
end

#exists?(hook_name) ⇒ Boolean

Returns:

  • (Boolean)

93
94
95
# File 'library/general/src/modules/Hooks.rb', line 93

def exists?(hook_name)
  !!find(hook_name)
end

#find(hook_name) ⇒ Object


85
86
87
# File 'library/general/src/modules/Hooks.rb', line 85

def find(hook_name)
  hooks[hook_name]
end

#run(hook_name) ⇒ Object


76
77
78
79
80
81
82
83
# File 'library/general/src/modules/Hooks.rb', line 76

def run(hook_name)
  hook_name = hook_name.to_s
  raise "Hook name not specified" if hook_name.empty?

  hook = create(hook_name, caller.first)
  hook.execute
  @last = hook
end