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

- (HooksClass) initialize

Returns a new instance of HooksClass



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

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

Instance Attribute Details

- (Object) last (readonly)

Returns the value of attribute last



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

def last
  @last
end

- (Object) search_path (readonly)

Returns the value of attribute search_path



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

def search_path
  @search_path
end

Instance Method Details

- (Object) all



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

def all
  hooks.values
end

- (Boolean) exists?(hook_name)

Returns:

  • (Boolean)


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

def exists? hook_name
  !!find(hook_name)
end

- (Object) find(hook_name)



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

def find hook_name
  hooks[hook_name]
end

- (Object) run(hook_name)



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

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