ext/iodine/iodine_mustache.c
/**
 * Called when an argument name was detected in the current section.
 *
 * A conforming implementation will search for the named argument both in the
 * existing section and all of it's parents (walking backwards towards the root)
 * until a value is detected.
 *
 * A missing value should be treated the same as an empty string.
 *
 * A conforming implementation will output the named argument's value (either
 * HTML escaped or not, depending on the `escape` flag) as a string.
 */
Called when an argument name was detected in the current section.
A conforming implementation will search for the named argument both in the
existing section and all of it's parents (walking backwards towards the root)
until a value is detected.

A missing value should be treated the same as an empty string.

A conforming implementation will output the named argument's value (either
HTML escaped or not, depending on the `escape` flag) as a string.
Called when an argument name was detected in the current section . A conforming implementation will search for the named argument both in the existing section and all of it ' s parents ( walking backwards towards the root ) until a value is detected . A missing value should be treated the same as an empty string . A conforming implementation will output the named argument ' s value ( either HTML escaped or not depending on the ` escape ` flag ) as a string .
static int mustache_on_arg(mustache_section_s *section, const char *name,
                           uint32_t name_len, unsigned char escape) {
  VALUE o = fiobj_mustache_find_obj(section, name, name_len);
  switch (o) {
  case Qnil:
  case Qfalse:
    return 0;
  case Qtrue:
    fio_str_write(section->udata1, "true", 4);
    break;
  }
  if (!RB_TYPE_P(o, T_STRING)) {
    if (rb_respond_to(o, call_func_id))
      o = IodineCaller.call(o, call_func_id);
    if (!RB_TYPE_P(o, T_STRING))
      o = IodineCaller.call(o, iodine_to_s_id);
  }
  if (!RB_TYPE_P(o, T_STRING) || !RSTRING_LEN(o))
    return 0;
  return mustache_write_text(section, RSTRING_PTR(o), RSTRING_LEN(o), escape);
}
static int mustache_on_arg ( mustache_section_s * section , const char * name , uint32_t name_len , unsigned char escape ) { VALUE o = fiobj_mustache_find_obj ( section , name , name_len ) ; switch ( o ) { case Qnil : case Qfalse : return 0 ; case Qtrue : fio_str_write ( section -> udata1 , " " , 4 ) ; break ; } if ( ! RB_TYPE_P ( o , T_STRING ) ) { if ( rb_respond_to ( o , call_func_id ) ) o = IodineCaller . call ( o , call_func_id ) ; if ( ! RB_TYPE_P ( o , T_STRING ) ) o = IodineCaller . call ( o , iodine_to_s_id ) ; } if ( ! RB_TYPE_P ( o , T_STRING ) || ! RSTRING_LEN ( o ) ) return 0 ; return mustache_write_text ( section , RSTRING_PTR ( o ) , RSTRING_LEN ( o ) , escape ) ; }
Called when an argument name was detected in the current section.
Called when an argument name was detected in the current section .