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
75
76
# File 'library/general/src/modules/Hooks.rb', line 70

def initialize
  super

  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



91
92
93
# File 'library/general/src/modules/Hooks.rb', line 91

def all
  hooks.values
end

#exists?(hook_name) ⇒ Boolean

Returns:

  • (Boolean)


95
96
97
# File 'library/general/src/modules/Hooks.rb', line 95

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

#find(hook_name) ⇒ Object



87
88
89
# File 'library/general/src/modules/Hooks.rb', line 87

def find(hook_name)
  hooks[hook_name]
end

#run(hook_name) ⇒ Object



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

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