Class: Inotify::Event
- Inherits:
-
Object
- Object
- Inotify::Event
- Defined in:
- lib/inotify/inotify_native.rb
Overview
The Inotify::Event class is used by Inotify when calling Inotify each_event method
Instance Method Summary collapse
-
#cookie ⇒ Object
Returns the cookie associated with the event.
-
#initialize(struct, buf) ⇒ Event
constructor
:nodoc:.
-
#inspect ⇒ Object
:nodoc:.
-
#len ⇒ Object
:nodoc:.
-
#mask ⇒ Object
Returns the mask describing the event.
-
#name ⇒ Object
Returns the file name associated with the event, if applicable.
-
#wd ⇒ Object
Returns the watch descriptor (wd) associated with the event.
Constructor Details
#initialize(struct, buf) ⇒ Event
:nodoc:
144 145 146 |
# File 'lib/inotify/inotify_native.rb', line 144 def initialize(struct, buf) # :nodoc: @struct, @buf = struct, buf end |
Instance Method Details
#cookie ⇒ Object
Returns the cookie associated with the event. If multiple events are triggered from the same action (such as renaming a file or directory), this value will be the same.
160 161 162 |
# File 'lib/inotify/inotify_native.rb', line 160 def @struct[:cookie] end |
#inspect ⇒ Object
:nodoc:
173 174 175 176 177 178 179 180 |
# File 'lib/inotify/inotify_native.rb', line 173 def inspect # :nodoc: "<%s name=%s mask=%s wd=%s>" % [ self.class, self.name, self.mask, self.wd ] end |
#len ⇒ Object
:nodoc:
164 165 166 |
# File 'lib/inotify/inotify_native.rb', line 164 def len # :nodoc: @struct[:len] end |
#mask ⇒ Object
Returns the mask describing the event
154 155 156 |
# File 'lib/inotify/inotify_native.rb', line 154 def mask @struct[:mask] end |
#name ⇒ Object
Returns the file name associated with the event, if applicable
169 170 171 |
# File 'lib/inotify/inotify_native.rb', line 169 def name @struct[:len] > 0 ? @buf.get_string(16, @struct[:len]) : '' end |
#wd ⇒ Object
Returns the watch descriptor (wd) associated with the event
149 150 151 |
# File 'lib/inotify/inotify_native.rb', line 149 def wd @struct[:wd] end |