Class: ESI::CParser

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

Direct Known Subclasses

Parser

Instance Method Summary collapse

Instance Method Details

#depthObject



236
237
238
239
240
# File 'ext/esi/esi_parser.c', line 236

static
VALUE ESIParser_get_depth( VALUE self )
{
  return rb_ivar_get( self, rb_intern("@depth") );
}

#depth=(depth) ⇒ Object



229
230
231
232
233
234
# File 'ext/esi/esi_parser.c', line 229

static
VALUE ESIParser_set_depth( VALUE self, VALUE depth )
{
  rb_ivar_set( self, rb_intern("@depth"), depth );
  return depth;
}

#end_tag_handlerObject



59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
# File 'ext/esi/esi_parser.c', line 59

static
VALUE ESIParser_set_end_tag_cb( VALUE self )
{
  ESIParser *parser;

  if( !rb_block_given_p() ){
    rb_raise(rb_eArgError, "Block expected. Call this method with a closure. { ... }");
  }

  Data_Get_Struct( self, ESIParser, parser );

  rb_ivar_set( self, rb_intern("@end_tag_block"), rb_block_proc() );

  return Qnil;
}

#esi_tagObject



223
224
225
226
227
# File 'ext/esi/esi_parser.c', line 223

static
VALUE ESIParser_get_esi_tag( VALUE self )
{
  return rb_ivar_get( self, rb_intern("@esi_tag") );
}

#esi_tag=(esi_tag) ⇒ Object



216
217
218
219
220
221
# File 'ext/esi/esi_parser.c', line 216

static
VALUE ESIParser_set_esi_tag( VALUE self, VALUE esi_tag )
{
  rb_ivar_set( self, rb_intern("@esi_tag"), esi_tag );
  return esi_tag;
}

#finishObject



177
178
179
180
181
182
183
184
185
186
187
# File 'ext/esi/esi_parser.c', line 177

static
VALUE ESIParser_finish( VALUE self )
{
  ESIParser *parser;

  Data_Get_Struct( self, ESIParser, parser );

  esi_parser_finish( parser );
  
  return Qnil;
}

#flushObject



165
166
167
168
169
170
171
172
173
174
175
# File 'ext/esi/esi_parser.c', line 165

static
VALUE ESIParser_flush( VALUE self )
{
  ESIParser *parser;

  Data_Get_Struct( self, ESIParser, parser );

  esi_parser_flush_output( parser );
  
  return Qnil;
}

#outputObject



249
250
251
252
253
# File 'ext/esi/esi_parser.c', line 249

static
VALUE ESIParser_get_output( VALUE self )
{
  return rb_ivar_get( self, rb_intern("@output") );
}

#output<<(output) ⇒ Object



254
255
256
257
258
259
260
261
262
263
264
# File 'ext/esi/esi_parser.c', line 254

static
VALUE ESIParser_send_output( VALUE self, VALUE output )
{
  ESIParser *parser;

  Data_Get_Struct( self, ESIParser, parser );

  esi_parser_default_output_cp( RSTRING_PTR(output), RSTRING_LEN(output), (void*)self );

  return Qnil;
}

#output=(output) ⇒ Object



242
243
244
245
246
247
# File 'ext/esi/esi_parser.c', line 242

static
VALUE ESIParser_set_output( VALUE self, VALUE output )
{
  rb_ivar_set( self, rb_intern("@output"), output );
  return output;
}

#output_handlerObject



27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'ext/esi/esi_parser.c', line 27

static 
VALUE ESIParser_set_output_cb( VALUE self )
{
  ESIParser *parser;

  if( !rb_block_given_p() ){
    rb_raise(rb_eArgError, "Block expected. Call this method with a closure. { ... }");
  }

  Data_Get_Struct( self, ESIParser, parser );

  rb_ivar_set( self, rb_intern("@output"), rb_block_proc() );

  return Qnil;
}

#process(data) ⇒ Object

}else {

  printf( "rb_thread_schedule\n" );
  rb_thread_schedule();
}


155
156
157
158
159
160
161
162
163
# File 'ext/esi/esi_parser.c', line 155

static
VALUE ESIParser_process( VALUE self, VALUE data )
{
  ESIParser *parser;

  Data_Get_Struct( self, ESIParser, parser );

  return rb_int_new( esi_parser_execute( parser, RSTRING_PTR( data ), RSTRING_LEN( data ) ) );
}

#start_tag_handlerObject



43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# File 'ext/esi/esi_parser.c', line 43

static
VALUE ESIParser_set_start_tag_cb( VALUE self )
{
  ESIParser *parser;

  if( !rb_block_given_p() ){
    rb_raise(rb_eArgError, "Block expected. Call this method with a closure. { ... }");
  }

  Data_Get_Struct( self, ESIParser, parser );

  rb_ivar_set( self, rb_intern("@start_tag_block"), rb_block_proc() );

  return Qnil;
}