Class: LSync::Directory
- Inherits:
-
Object
- Object
- LSync::Directory
- Includes:
- EventHandler
- Defined in:
- lib/lsync/directory.rb
Overview
A specific directory which is relative to the root of a given server. Specific configuration details such as excludes and other options may be specified.
Instance Attribute Summary collapse
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
Instance Method Summary collapse
-
#exclude(pattern) ⇒ Object
Exclude a specific shell glob pattern.
-
#initialize(path) ⇒ Directory
constructor
A new instance of Directory.
-
#to_s ⇒ Object
A string representation of the path for logging.
Methods included from EventHandler
Constructor Details
#initialize(path) ⇒ Directory
Returns a new instance of Directory.
67 68 69 70 71 72 73 74 |
# File 'lib/lsync/directory.rb', line 67 def initialize(path) @path = Pathname.new(path).cleanpath.normalize_trailing_slash @options = {:arguments => []} if @path.absolute? raise AbsolutePathError.new("Path #{path} may not be absolute!", :path => path) end end |
Instance Attribute Details
#options ⇒ Object (readonly)
Returns the value of attribute options.
77 78 79 |
# File 'lib/lsync/directory.rb', line 77 def @options end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
76 77 78 |
# File 'lib/lsync/directory.rb', line 76 def path @path end |
Instance Method Details
#exclude(pattern) ⇒ Object
Exclude a specific shell glob pattern.
80 81 82 83 |
# File 'lib/lsync/directory.rb', line 80 def exclude(pattern) # RSync specific... need to figure out if there is a good way to do this generally. @options[:arguments] += ["--exclude", pattern] end |
#to_s ⇒ Object
A string representation of the path for logging.
86 87 88 |
# File 'lib/lsync/directory.rb', line 86 def to_s @path.to_s end |