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



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

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

Instance Attribute Details

#lastObject (readonly)

Returns the value of attribute last



64
65
66
# File 'library/general/src/modules/Hooks.rb', line 64

def last
  @last
end

#search_pathObject (readonly)

Returns the value of attribute search_path



64
65
66
# File 'library/general/src/modules/Hooks.rb', line 64

def search_path
  @search_path
end

Instance Method Details

#allObject



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

def all
  hooks.values
end

#exists?(hook_name) ⇒ Boolean

Returns:

  • (Boolean)


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

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

#find(hook_name) ⇒ Object



83
84
85
# File 'library/general/src/modules/Hooks.rb', line 83

def find(hook_name)
  hooks[hook_name]
end

#run(hook_name) ⇒ Object



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

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