Class: FSEvent

Inherits:
Object
  • Object
show all
Defined in:
ext/fsevent.c

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeObject



73
74
75
76
# File 'ext/fsevent.c', line 73

static VALUE t_init(VALUE self) {
  rb_iv_set(self, "@latency", rb_float_new(0.5));
  return self;
}

Instance Attribute Details

#latencyObject

#registered_directoriesObject

Instance Method Details

#on_change(original_directory_name) ⇒ Object



78
79
80
81
# File 'ext/fsevent.c', line 78

static VALUE t_on_change(VALUE self, VALUE original_directory_name) {
  rb_raise(rb_eNotImpError, "You must define #on_change in your subclass");
  return self;
}

#restartObject



110
111
112
113
114
# File 'ext/fsevent.c', line 110

static VALUE t_restart(VALUE self) {
  t_stop(self);
  watch_directory(self);
  return self;
}

#startObject



94
95
96
97
98
99
100
# File 'ext/fsevent.c', line 94

static VALUE t_start(VALUE self) {
  VALUE rb_registered_directories = rb_iv_get(self, "@registered_directories");
  Check_Type(rb_registered_directories, T_ARRAY);

  watch_directory(self);
  return self;
}

#stopObject



102
103
104
105
106
107
108
# File 'ext/fsevent.c', line 102

static VALUE t_stop(VALUE self) {
  FSEventStreamStop(stream);
  FSEventStreamInvalidate(stream);
  FSEventStreamRelease(stream);
  CFRunLoopStop(CFRunLoopGetCurrent());
  return self;
}

#watch_directories(directories) ⇒ Object



83
84
85
86
87
88
89
90
91
92
# File 'ext/fsevent.c', line 83

static VALUE t_watch_directories(VALUE self, VALUE directories) {
  if (TYPE(directories) == T_ARRAY) {
    rb_iv_set(self, "@registered_directories", rb_ary_new4(RARRAY_LEN(directories), RARRAY_PTR(directories)));
  }
  else {
    rb_iv_set(self, "@registered_directories", rb_ary_new3(1, directories));
  }
  VALUE rb_registered_directories = rb_iv_get(self, "@registered_directories");
  return rb_registered_directories;
}