Class: Inotify::Event
- Inherits:
-
Object
- Object
- Inotify::Event
- Defined in:
- lib/inotify-ffi.rb
Instance Method Summary collapse
-
#initialize(struct, buf) ⇒ Event
constructor
A new instance of Event.
- #inspect ⇒ Object
- #is?(*c) ⇒ Boolean
- #len ⇒ Object
- #mask ⇒ Object
- #mask_names ⇒ Object
- #name ⇒ Object
- #wd ⇒ Object
Constructor Details
#initialize(struct, buf) ⇒ Event
Returns a new instance of Event.
68 69 70 |
# File 'lib/inotify-ffi.rb', line 68 def initialize(struct, buf) @struct, @buf = struct, buf end |
Instance Method Details
#inspect ⇒ Object
80 81 82 83 84 85 86 87 |
# File 'lib/inotify-ffi.rb', line 80 def inspect "<%s: wd:%s mask:%s len=%s>" % [ name, @struct[:wd], @struct[:mask], @struct[:len] ] end |
#is?(*c) ⇒ Boolean
76 77 78 |
# File 'lib/inotify-ffi.rb', line 76 def is?(*c) c.all? {|c| (mask & c) > 0 } end |
#len ⇒ Object
74 |
# File 'lib/inotify-ffi.rb', line 74 def len ; @struct[:len] ; end |
#mask ⇒ Object
72 |
# File 'lib/inotify-ffi.rb', line 72 def mask ; @struct[:mask] ; end |
#mask_names ⇒ Object
89 90 91 92 93 94 |
# File 'lib/inotify-ffi.rb', line 89 def mask_names Const.constants.select do |const| value = Const.const_get(const) @struct[:mask] & value > 0 end end |
#name ⇒ Object
96 97 98 |
# File 'lib/inotify-ffi.rb', line 96 def name @struct[:len] >= 0 ? @buf.get_string(@struct[:len]) : '<unknown>' end |
#wd ⇒ Object
73 |
# File 'lib/inotify-ffi.rb', line 73 def wd ; @struct[:wd] ; end |