Class: Yast::HooksClass::Hook
- Inherits:
-
Object
- Object
- Yast::HooksClass::Hook
- Includes:
- Logger
- Defined in:
- library/general/src/modules/Hooks.rb
Instance Attribute Summary collapse
-
#caller_path ⇒ Object
readonly
Returns the value of attribute caller_path.
-
#files ⇒ Object
readonly
Returns the value of attribute files.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#search_path ⇒ Object
readonly
Returns the value of attribute search_path.
Instance Method Summary collapse
- #execute ⇒ Object
- #failed? ⇒ Boolean
-
#initialize(name, caller_path, search_path) ⇒ Hook
constructor
A new instance of Hook.
- #results ⇒ Object
- #succeeded? ⇒ Boolean
- #used? ⇒ Boolean
Constructor Details
#initialize(name, caller_path, search_path) ⇒ Hook
Returns a new instance of Hook.
157 158 159 160 161 162 163 164 |
# File 'library/general/src/modules/Hooks.rb', line 157 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
#caller_path ⇒ Object (readonly)
Returns the value of attribute caller_path.
155 156 157 |
# File 'library/general/src/modules/Hooks.rb', line 155 def caller_path @caller_path end |
#files ⇒ Object (readonly)
Returns the value of attribute files.
155 156 157 |
# File 'library/general/src/modules/Hooks.rb', line 155 def files @files end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
155 156 157 |
# File 'library/general/src/modules/Hooks.rb', line 155 def name @name end |
#search_path ⇒ Object (readonly)
Returns the value of attribute search_path.
155 156 157 |
# File 'library/general/src/modules/Hooks.rb', line 155 def search_path @search_path end |
Instance Method Details
#execute ⇒ Object
166 167 168 169 |
# File 'library/general/src/modules/Hooks.rb', line 166 def execute Builtins.y2milestone "Executing hook '#{name}'" files.each(&:execute) end |
#failed? ⇒ Boolean
183 184 185 |
# File 'library/general/src/modules/Hooks.rb', line 183 def failed? !succeeded? end |
#results ⇒ Object
175 176 177 |
# File 'library/general/src/modules/Hooks.rb', line 175 def results files.map(&:result) end |
#succeeded? ⇒ Boolean
179 180 181 |
# File 'library/general/src/modules/Hooks.rb', line 179 def succeeded? files.all?(&:succeeded?) end |
#used? ⇒ Boolean
171 172 173 |
# File 'library/general/src/modules/Hooks.rb', line 171 def used? !files.empty? end |