Skip to content

Commit

Permalink
Add mask to Inotify::Event
Browse files Browse the repository at this point in the history
  • Loading branch information
aredridel committed Nov 19, 2005
1 parent 93a1d8f commit f8950cc
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
13 changes: 13 additions & 0 deletions ext/inotify.c
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,18 @@ static VALUE rb_inotify_event_name(VALUE self) {
}
}

/*
* call-seq:
* inotify_event.mask => 0xcafebabe
*
*/

static VALUE rb_inotify_event_mask(VALUE self) {
struct inotify_event *event;
Data_Get_Struct(self, struct inotify_event, event);
return LONG2NUM(event->mask);
}

void Init_inotify () {
rb_cInotify = rb_define_class("Inotify", rb_cObject);
rb_cInotifyEvent = rb_define_class_under(rb_cInotify, "Event", rb_cObject);
Expand Down Expand Up @@ -191,4 +203,5 @@ void Init_inotify () {
rb_define_method(rb_cInotify, "close", rb_inotify_close, 0);
rb_define_method(rb_cInotifyEvent, "inspect", rb_inotify_event_inspect, 0);
rb_define_method(rb_cInotifyEvent, "name", rb_inotify_event_name, 0);
rb_define_method(rb_cInotifyEvent, "mask", rb_inotify_event_mask, 0);
}
1 change: 1 addition & 0 deletions tests/test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ def test4
assert_equal(ev.class, Inotify::Event)
assert_equal(ev.inspect, "<Inotify::Event:0xDEADBEEF name=FIXME mask=FIXME>")
assert_equal(ev.name, "ruby-inotify-test-4")
assert_equal(ev.mask, Inotify::CREATE)
break
end
ensure
Expand Down

0 comments on commit f8950cc

Please sign in to comment.