Class: Yast::HooksClass
- Inherits:
-
Module
- Object
- Module
- Yast::HooksClass
- Includes:
- Logger
- Defined in:
- library/general/src/modules/Hooks.rb
Defined Under Namespace
Classes: Hook, HookFile, SearchPath
Instance Attribute Summary collapse
-
#last ⇒ Object
readonly
Returns the value of attribute last.
-
#search_path ⇒ Object
readonly
Returns the value of attribute search_path.
Instance Method Summary collapse
- #all ⇒ Object
- #exists?(hook_name) ⇒ Boolean
- #find(hook_name) ⇒ Object
-
#initialize ⇒ HooksClass
constructor
A new instance of HooksClass.
- #run(hook_name) ⇒ Object
Constructor Details
#initialize ⇒ HooksClass
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
#last ⇒ Object (readonly)
Returns the value of attribute last.
66 67 68 |
# File 'library/general/src/modules/Hooks.rb', line 66 def last @last end |
#search_path ⇒ Object (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
#all ⇒ Object
91 92 93 |
# File 'library/general/src/modules/Hooks.rb', line 91 def all hooks.values end |
#exists?(hook_name) ⇒ 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 |