Class: Sinotify::Watch
- Inherits:
-
Object
- Object
- Sinotify::Watch
- Defined in:
- lib/sinotify/watch.rb
Overview
Just a little struct to describe a single inotifier watch Note that the is_dir needs to be saved because we won’t be able to deduce that later if it was a deleted object.
Instance Attribute Summary collapse
-
#is_dir ⇒ Object
Returns the value of attribute is_dir.
-
#path ⇒ Object
Returns the value of attribute path.
-
#watch_descriptor ⇒ Object
Returns the value of attribute watch_descriptor.
Instance Method Summary collapse
- #directory? ⇒ Boolean
-
#initialize(args = {}) ⇒ Watch
constructor
A new instance of Watch.
- #to_s ⇒ Object
Constructor Details
#initialize(args = {}) ⇒ Watch
Returns a new instance of Watch.
9 10 11 12 13 |
# File 'lib/sinotify/watch.rb', line 9 def initialize(args={}) args.each{|k,v| self.send("#{k}=",v)} @timestamp ||= Time.now @is_dir = File.directory?(path) end |
Instance Attribute Details
#is_dir ⇒ Object
Returns the value of attribute is_dir.
8 9 10 |
# File 'lib/sinotify/watch.rb', line 8 def is_dir @is_dir end |
#path ⇒ Object
Returns the value of attribute path.
8 9 10 |
# File 'lib/sinotify/watch.rb', line 8 def path @path end |
#watch_descriptor ⇒ Object
Returns the value of attribute watch_descriptor.
8 9 10 |
# File 'lib/sinotify/watch.rb', line 8 def watch_descriptor @watch_descriptor end |
Instance Method Details
#directory? ⇒ Boolean
14 15 16 |
# File 'lib/sinotify/watch.rb', line 14 def directory? self.is_dir.eql?(true) end |
#to_s ⇒ Object
17 18 19 |
# File 'lib/sinotify/watch.rb', line 17 def to_s "Sinotify::Watch[:is_dir => #{is_dir}, :path => #{path}, :watch_descriptor => #{watch_descriptor}]" end |