Class: Resource::Hook

Inherits:
Base
  • Object
show all
Defined in:
lib/resource/hook.rb

Instance Method Summary collapse

Methods inherited from Base

inherited, #not_if, #set_base_defaults, #unix_mode

Methods included from ClassAttr

included

Methods included from BlockAttr

included

Constructor Details

#initialize(target, binding) ⇒ Hook



5
6
7
8
# File 'lib/resource/hook.rb', line 5

def initialize target, binding
  @target = target
  @binding = binding
end

Instance Method Details

#runObject



10
11
12
13
14
15
16
17
# File 'lib/resource/hook.rb', line 10

def run
  if ::File.exist?(@target)
    Output.info 'Hook found', @target
    eval(::File.read(@target), @binding)
  else
    Output.warn 'Hook not found', @target
  end
end

#should_skip?Boolean



19
20
21
# File 'lib/resource/hook.rb', line 19

def should_skip?
  false
end