mirror of
https://github.com/haml/haml.git
synced 2022-11-09 12:33:31 -05:00
Cosmetic changes
This commit is contained in:
parent
360c454ed5
commit
447c834da6
1 changed files with 8 additions and 9 deletions
|
@ -30,12 +30,11 @@ static VALUE
|
||||||
attr_build_id(VALUE escape_attrs, VALUE ids)
|
attr_build_id(VALUE escape_attrs, VALUE ids)
|
||||||
{
|
{
|
||||||
VALUE id, attr_value;
|
VALUE id, attr_value;
|
||||||
long i, len;
|
long i;
|
||||||
|
|
||||||
ids = rb_funcall(ids, id_flatten, 0);
|
ids = rb_funcall(ids, id_flatten, 0);
|
||||||
|
|
||||||
len = RARRAY_LEN(ids);
|
for (i = RARRAY_LEN(ids) - 1; 0 <= i; i--) {
|
||||||
for (i = len - 1; 0 <= i; i--) {
|
|
||||||
id = rb_ary_entry(ids, i);
|
id = rb_ary_entry(ids, i);
|
||||||
if (!RTEST(id)) {
|
if (!RTEST(id)) {
|
||||||
rb_ary_delete_at(ids, i);
|
rb_ary_delete_at(ids, i);
|
||||||
|
@ -66,15 +65,15 @@ Init_hamlit(void)
|
||||||
{
|
{
|
||||||
VALUE mHamlit, mUtils;
|
VALUE mHamlit, mUtils;
|
||||||
|
|
||||||
mHamlit = rb_define_module("Hamlit");
|
mHamlit = rb_define_module("Hamlit");
|
||||||
mUtils = rb_define_module_under(mHamlit, "Utils");
|
mUtils = rb_define_module_under(mHamlit, "Utils");
|
||||||
rb_define_singleton_method(mUtils, "escape_html", rb_escape_html, 1);
|
|
||||||
|
|
||||||
mAttributeBuilder = rb_define_module_under(mHamlit, "AttributeBuilder");
|
mAttributeBuilder = rb_define_module_under(mHamlit, "AttributeBuilder");
|
||||||
|
|
||||||
|
rb_define_singleton_method(mUtils, "escape_html", rb_escape_html, 1);
|
||||||
rb_define_singleton_method(mAttributeBuilder, "build_id", rb_attr_build_id, -1);
|
rb_define_singleton_method(mAttributeBuilder, "build_id", rb_attr_build_id, -1);
|
||||||
|
|
||||||
id_flatten = rb_intern("flatten");
|
id_flatten = rb_intern("flatten");
|
||||||
|
|
||||||
id_underscore = rb_intern("UNDERSCORE");
|
id_underscore = rb_intern("UNDERSCORE");
|
||||||
|
|
||||||
rb_const_set(mAttributeBuilder, id_underscore, rb_obj_freeze(rb_str_new_cstr("_")));
|
rb_const_set(mAttributeBuilder, id_underscore, rb_obj_freeze(rb_str_new_cstr("_")));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue