Class: GrokDiscover
- Inherits:
-
Object
- Object
- GrokDiscover
- Defined in:
- ext/ruby_grokdiscover.c
Class Method Summary collapse
Instance Method Summary collapse
Constructor Details
#initialize(rb_grok) ⇒ Object
24 25 26 27 28 29 30 31 32 |
# File 'ext/ruby_grokdiscover.c', line 24
VALUE rGrokDiscover_initialize(VALUE self, VALUE rb_grok) {
grok_discover_t *gdt;
grok_t *grok;
Data_Get_Struct(self, grok_discover_t, gdt);
Data_Get_Struct(rb_grok, grok_t, grok);
grok_discover_init(gdt, grok);
return Qnil;
}
|
Class Method Details
.new(grok) ⇒ Object
9 10 11 12 13 14 15 16 17 |
# File 'ext/ruby_grokdiscover.c', line 9
VALUE rGrokDiscover_new(VALUE klass, VALUE grok) {
VALUE rgd;
grok_discover_t *gdt = ALLOC(grok_discover_t); //grok_discover_new();
rgd = Data_Wrap_Struct(klass, 0, rGrokDiscover_free, gdt);
VALUE initargs[1] = { grok };
rb_obj_call_init(rgd, 1, initargs);
return (VALUE)rgd;
}
|
Instance Method Details
#discover(input) ⇒ Object
35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'ext/ruby_grokdiscover.c', line 35
VALUE rGrokDiscover_discover(VALUE self, VALUE input) {
char *cstr_discovery;
char *cstr_input;
long unused_input_len;
int discovery_len;
grok_discover_t *gdt;
grok_t *grok;
Data_Get_Struct(self, grok_discover_t, gdt);
cstr_input = rb_str2cstr(input, &unused_input_len);
grok_discover(gdt, cstr_input, &cstr_discovery, &discovery_len);
return rb_str_new(cstr_discovery, discovery_len);
}
|