Class: Yast::HooksClass::Hook

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

Instance Attribute Summary (collapse)

Instance Method Summary (collapse)

Constructor Details

- (Hook) initialize(name, caller_path, search_path)

Returns a new instance of Hook



156
157
158
159
160
161
162
163
# File '../../library/general/src/modules/Hooks.rb', line 156

def initialize name, caller_path, search_path
  log.debug "Creating hook '#{name}' from '#{self.caller_path}'"
  search_path.verify!
  @search_path = search_path
  @name = name
  @files = find_hook_files(name).map {|path| HookFile.new(path) }
  @caller_path = caller_path.split(':in').first
end

Instance Attribute Details

- (Object) caller_path (readonly)

Returns the value of attribute caller_path



154
155
156
# File '../../library/general/src/modules/Hooks.rb', line 154

def caller_path
  @caller_path
end

- (Object) files (readonly)

Returns the value of attribute files



154
155
156
# File '../../library/general/src/modules/Hooks.rb', line 154

def files
  @files
end

- (Object) name (readonly)

Returns the value of attribute name



154
155
156
# File '../../library/general/src/modules/Hooks.rb', line 154

def name
  @name
end

- (Object) results (readonly)

Returns the value of attribute results



154
155
156
# File '../../library/general/src/modules/Hooks.rb', line 154

def results
  @results
end

- (Object) search_path (readonly)

Returns the value of attribute search_path



154
155
156
# File '../../library/general/src/modules/Hooks.rb', line 154

def search_path
  @search_path
end

Instance Method Details

- (Object) execute



165
166
167
168
# File '../../library/general/src/modules/Hooks.rb', line 165

def execute
  Builtins.y2milestone "Executing hook '#{name}'"
  files.each &:execute
end

- (Boolean) failed?

Returns:

  • (Boolean)


182
183
184
# File '../../library/general/src/modules/Hooks.rb', line 182

def failed?
  !succeeded?
end

- (Boolean) succeeded?

Returns:

  • (Boolean)


178
179
180
# File '../../library/general/src/modules/Hooks.rb', line 178

def succeeded?
  files.all? &:succeeded?
end

- (Boolean) used?

Returns:

  • (Boolean)


170
171
172
# File '../../library/general/src/modules/Hooks.rb', line 170

def used?
  !files.empty?
end