Class: Wright::Resource::Symlink
- Inherits:
-
Wright::Resource
- Object
- Wright::Resource
- Wright::Resource::Symlink
- Defined in:
- lib/wright/resource/symlink.rb
Overview
Symlink resource, represents a symlink.
Instance Attribute Summary collapse
-
#to ⇒ String
The symlink’s intended target.
Attributes inherited from Wright::Resource
#action, #ignore_failure, #name, #resource_name
Instance Method Summary collapse
-
#create ⇒ Bool
Creates or updates the symlink.
-
#initialize(name) ⇒ Symlink
constructor
Initializes a Symlink.
-
#remove ⇒ Bool
Removes the symlink.
Methods inherited from Wright::Resource
Constructor Details
#initialize(name) ⇒ Symlink
Initializes a Symlink.
16 17 18 19 20 |
# File 'lib/wright/resource/symlink.rb', line 16 def initialize(name) super @to = nil @action = :create end |
Instance Attribute Details
#to ⇒ String
Returns the symlink’s intended target.
23 24 25 |
# File 'lib/wright/resource/symlink.rb', line 23 def to @to end |
Instance Method Details
#create ⇒ Bool
Creates or updates the symlink.
29 30 31 32 33 34 |
# File 'lib/wright/resource/symlink.rb', line 29 def create fail ArgumentError, 'Symlink target undefined' unless @to might_update_resource do @provider.create end end |
#remove ⇒ Bool
Removes the symlink.
40 41 42 43 44 |
# File 'lib/wright/resource/symlink.rb', line 40 def remove might_update_resource do @provider.remove end end |