Class: Liquid::C::ResourceLimits
- Inherits:
-
Object
- Object
- Liquid::C::ResourceLimits
- Defined in:
- ext/liquid_c/resource_limits.c
Instance Method Summary collapse
- #assign_score ⇒ Object
- #assign_score_limit ⇒ Object
- #assign_score_limit=(assign_score_limit) ⇒ Object
- #increment_assign_score(amount) ⇒ Object
- #increment_render_score(amount) ⇒ Object
- #increment_write_score(output) ⇒ Object
- #initialize(render_length_limit, render_score_limit, assign_score_limit) ⇒ Object constructor
- #raise_limits_reached ⇒ Object
- #reached? ⇒ Boolean
- #render_length_limit ⇒ Object
- #render_length_limit=(render_length_limit) ⇒ Object
- #render_score ⇒ Object
- #render_score_limit ⇒ Object
- #render_score_limit=(render_score_limit) ⇒ Object
- #reset ⇒ Object
- #with_capture ⇒ Object
Constructor Details
#initialize(render_length_limit, render_score_limit, assign_score_limit) ⇒ Object
124 125 126 127 128 129 130 131 132 |
# File 'ext/liquid_c/resource_limits.c', line 124
static VALUE resource_limits_initialize_method(VALUE self, VALUE render_length_limit,
VALUE render_score_limit, VALUE assign_score_limit)
{
resource_limits_set_render_length_limit_method(self, render_length_limit);
resource_limits_set_render_score_limit_method(self, render_score_limit);
resource_limits_set_assign_score_limit_method(self, assign_score_limit);
return Qnil;
}
|
Instance Method Details
#assign_score ⇒ Object
116 117 118 119 120 121 122 |
# File 'ext/liquid_c/resource_limits.c', line 116
static VALUE resource_limits_assign_score_method(VALUE self)
{
resource_limits_t *resource_limits;
ResourceLimits_Get_Struct(self, resource_limits);
return LONG2NUM(resource_limits->assign_score);
}
|
#assign_score_limit ⇒ Object
86 87 88 89 90 91 92 |
# File 'ext/liquid_c/resource_limits.c', line 86
static VALUE resource_limits_assign_score_limit_method(VALUE self)
{
resource_limits_t *resource_limits;
ResourceLimits_Get_Struct(self, resource_limits);
return LONG2NUM(resource_limits->assign_score_limit);
}
|
#assign_score_limit=(assign_score_limit) ⇒ Object
94 95 96 97 98 99 100 101 102 103 104 105 106 |
# File 'ext/liquid_c/resource_limits.c', line 94
static VALUE resource_limits_set_assign_score_limit_method(VALUE self, VALUE assign_score_limit)
{
resource_limits_t *resource_limits;
ResourceLimits_Get_Struct(self, resource_limits);
if (assign_score_limit == Qnil) {
resource_limits->assign_score_limit = LONG_MAX;
} else {
resource_limits->assign_score_limit = NUM2LONG(assign_score_limit);
}
return Qnil;
}
|
#increment_assign_score(amount) ⇒ Object
169 170 171 172 173 174 175 176 177 |
# File 'ext/liquid_c/resource_limits.c', line 169
static VALUE resource_limits_increment_assign_score_method(VALUE self, VALUE amount)
{
resource_limits_t *resource_limits;
ResourceLimits_Get_Struct(self, resource_limits);
resource_limits_increment_assign_score(resource_limits, NUM2LONG(amount));
return Qnil;
}
|
#increment_render_score(amount) ⇒ Object
150 151 152 153 154 155 156 157 158 |
# File 'ext/liquid_c/resource_limits.c', line 150
static VALUE resource_limits_increment_render_score_method(VALUE self, VALUE amount)
{
resource_limits_t *resource_limits;
ResourceLimits_Get_Struct(self, resource_limits);
resource_limits_increment_render_score(resource_limits, NUM2LONG(amount));
return Qnil;
}
|
#increment_write_score(output) ⇒ Object
192 193 194 195 196 197 198 199 200 201 202 |
# File 'ext/liquid_c/resource_limits.c', line 192
static VALUE resource_limits_increment_write_score_method(VALUE self, VALUE output)
{
Check_Type(output, T_STRING);
resource_limits_t *resource_limits;
ResourceLimits_Get_Struct(self, resource_limits);
resource_limits_increment_write_score(resource_limits, output);
return Qnil;
}
|
#raise_limits_reached ⇒ Object
204 205 206 207 208 209 210 |
# File 'ext/liquid_c/resource_limits.c', line 204
static VALUE resource_limits_raise_limits_reached_method(VALUE self)
{
resource_limits_t *resource_limits;
ResourceLimits_Get_Struct(self, resource_limits);
resource_limits_raise_limits_reached(resource_limits);
}
|
#reached? ⇒ Boolean
212 213 214 215 216 217 218 |
# File 'ext/liquid_c/resource_limits.c', line 212
static VALUE resource_limits_reached_method(VALUE self)
{
resource_limits_t *resource_limits;
ResourceLimits_Get_Struct(self, resource_limits);
return resource_limits->reached_limit ? Qtrue : Qfalse;
}
|
#render_length_limit ⇒ Object
42 43 44 45 46 47 48 |
# File 'ext/liquid_c/resource_limits.c', line 42
static VALUE resource_limits_render_length_limit_method(VALUE self)
{
resource_limits_t *resource_limits;
ResourceLimits_Get_Struct(self, resource_limits);
return LONG2NUM(resource_limits->render_length_limit);
}
|
#render_length_limit=(render_length_limit) ⇒ Object
50 51 52 53 54 55 56 57 58 59 60 61 62 |
# File 'ext/liquid_c/resource_limits.c', line 50
static VALUE resource_limits_set_render_length_limit_method(VALUE self, VALUE render_length_limit)
{
resource_limits_t *resource_limits;
ResourceLimits_Get_Struct(self, resource_limits);
if (render_length_limit == Qnil) {
resource_limits->render_length_limit = LONG_MAX;
} else {
resource_limits->render_length_limit = NUM2LONG(render_length_limit);
}
return Qnil;
}
|
#render_score ⇒ Object
108 109 110 111 112 113 114 |
# File 'ext/liquid_c/resource_limits.c', line 108
static VALUE resource_limits_render_score_method(VALUE self)
{
resource_limits_t *resource_limits;
ResourceLimits_Get_Struct(self, resource_limits);
return LONG2NUM(resource_limits->render_score);
}
|
#render_score_limit ⇒ Object
64 65 66 67 68 69 70 |
# File 'ext/liquid_c/resource_limits.c', line 64
static VALUE resource_limits_render_score_limit_method(VALUE self)
{
resource_limits_t *resource_limits;
ResourceLimits_Get_Struct(self, resource_limits);
return LONG2NUM(resource_limits->render_score_limit);
}
|
#render_score_limit=(render_score_limit) ⇒ Object
72 73 74 75 76 77 78 79 80 81 82 83 84 |
# File 'ext/liquid_c/resource_limits.c', line 72
static VALUE resource_limits_set_render_score_limit_method(VALUE self, VALUE render_score_limit)
{
resource_limits_t *resource_limits;
ResourceLimits_Get_Struct(self, resource_limits);
if (render_score_limit == Qnil) {
resource_limits->render_score_limit = LONG_MAX;
} else {
resource_limits->render_score_limit = NUM2LONG(render_score_limit);
}
return Qnil;
}
|
#reset ⇒ Object
249 250 251 252 253 254 255 |
# File 'ext/liquid_c/resource_limits.c', line 249
static VALUE resource_limits_reset_method(VALUE self)
{
resource_limits_t *resource_limits;
ResourceLimits_Get_Struct(self, resource_limits);
resource_limits_reset(resource_limits);
return Qnil;
}
|
#with_capture ⇒ Object
233 234 235 236 237 238 239 240 241 242 243 244 245 246 |
# File 'ext/liquid_c/resource_limits.c', line 233
static VALUE resource_limits_with_capture_method(VALUE self)
{
resource_limits_t *resource_limits;
ResourceLimits_Get_Struct(self, resource_limits);
struct capture_ensure_t ensure_data = {
.resource_limits = resource_limits,
.old_capture_length = resource_limits->last_capture_length
};
resource_limits->last_capture_length = 0;
return rb_ensure(rb_yield, Qundef, capture_ensure, (VALUE)&ensure_data);
}
|