Module: Faml::AttributeBuilder

Defined in:
ext/attribute_builder/attribute_builder.c

Class Method Summary collapse

Class Method Details

.buildObject



253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
# File 'ext/attribute_builder/attribute_builder.c', line 253

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_const_get(rb_mAttributeBuilder, id_id), rb_ary_new());
  rb_hash_aset(attributes, rb_const_get(rb_mAttributeBuilder, id_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();
  for (i = 0; i < len; i++) {
    VALUE k = RARRAY_AREF(keys, i);
    build_attribute(buf, attr_quote, is_html, k, rb_hash_lookup(attributes, k));
  }

  return rb_ary_join(buf, Qnil);
}

.normalize_dataObject



280
281
282
283
284
# File 'ext/attribute_builder/attribute_builder.c', line 280

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