Class: Wright::Resource::Symlink
- Inherits:
-
Wright::Resource
- Object
- Wright::Resource
- Wright::Resource::Symlink
- Defined in:
- lib/wright/resource/symlink.rb
Overview
Public: Symlink resource, represents a symlink.
Examples
link = Wright::Resource::Symlink.new('/tmp/fstab')
link.to = '/etc/fstab'
link.create
Instance Attribute Summary collapse
-
#to ⇒ Object
Public: Get/Set the link’s target.
Attributes inherited from Wright::Resource
#action, #ignore_failure, #name, #resource_name
Instance Method Summary collapse
-
#create ⇒ Object
Public: Create or update the Symlink.
-
#initialize(name) ⇒ Symlink
constructor
Public: Initialize a Symlink.
-
#remove ⇒ Object
Public: Remove the Symlink.
Methods inherited from Wright::Resource
Constructor Details
#initialize(name) ⇒ Symlink
Public: Initialize a Symlink.
name - The link’s name.
17 18 19 20 21 |
# File 'lib/wright/resource/symlink.rb', line 17 def initialize(name) super @to = nil @action = :create end |
Instance Attribute Details
#to ⇒ Object
Public: Get/Set the link’s target.
24 25 26 |
# File 'lib/wright/resource/symlink.rb', line 24 def to @to end |
Instance Method Details
#create ⇒ Object
Public: Create or update the Symlink.
Returns true if the symlink was updated and false otherwise.
29 30 31 32 33 |
# File 'lib/wright/resource/symlink.rb', line 29 def create might_update_resource do @provider.create end end |
#remove ⇒ Object
Public: Remove the Symlink.
Returns true if the symlink was updated and false otherwise.
38 39 40 41 42 |
# File 'lib/wright/resource/symlink.rb', line 38 def remove might_update_resource do @provider.remove end end |