Class: Hookit::Resource::Link

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

Instance Attribute Summary

Attributes inherited from Base

#dict

Instance Method Summary collapse

Methods inherited from Base

#action, actions, #can_run?, default_action, #default_action, field, #not_if, #only_if

Constructor Details

#initialize(name) ⇒ Link

Returns a new instance of Link.



14
15
16
17
18
# File 'lib/hookit/resource/link.rb', line 14

def initialize(name)
  target_file name unless target_file
  link_type :symbolic
  super
end

Instance Method Details

#run(action) ⇒ Object



20
21
22
23
24
25
26
27
28
# File 'lib/hookit/resource/link.rb', line 20

def run(action)
  case action
  when :create
    create!
    chown!
  when :delete
    delete!
  end
end