Module: Faml::AttributeBuilder

Defined in:
ext/attribute_builder/attribute_builder.c

Class Method Summary collapse

Class Method Details

.buildObject



218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
# File 'ext/attribute_builder/attribute_builder.c', line 218

static VALUE
m_build(int argc, VALUE *argv, RB_UNUSED_VAR(VALUE self))
{
  VALUE attr_quote, attributes, keys, buf;
  int is_html;
  long len, i;

  rb_check_arity(argc, 2, UNLIMITED_ARGUMENTS);
  attr_quote = argv[0];
  is_html = RTEST(argv[1]);
  attributes = rb_hash_new();
  rb_hash_aset(attributes, rb_str_new_cstr("id"), rb_ary_new());
  rb_hash_aset(attributes, rb_str_new_cstr("class"), rb_ary_new());
  merge(attributes, argc-2, argv+2);

  keys = rb_funcall(attributes, id_keys, 0);
  rb_funcall(keys, id_sort_bang, 0);
  len = RARRAY_LEN(keys);
  buf = rb_ary_new_capa(len);
  for (i = 0; i < len; i++) {
    VALUE k = RARRAY_AREF(keys, i);
    rb_ary_push(buf, build_attribute(attr_quote, is_html, k, rb_hash_lookup(attributes, k)));
  }

  return rb_ary_join(buf, Qnil);
}

.normalize_dataObject



245
246
247
248
249
# File 'ext/attribute_builder/attribute_builder.c', line 245

static VALUE
m_normalize_data(RB_UNUSED_VAR(VALUE self), VALUE data)
{
  return normalize_data(data);
}