Module: Droonga::Searcher::AttributeFormattable

Included in:
ComplexAttributesFormatter, SimpleAttributesFormatter
Defined in:
lib/droonga/searcher.rb

Instance Method Summary collapse

Instance Method Details

#format_attribute(attribute, table) ⇒ Object



458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
# File 'lib/droonga/searcher.rb', line 458

def format_attribute(attribute, table)
  label = attribute[:label]
  source = attribute[:source]
  if source == "_subrecs"
    sub_record_table = table.range
    sub_attributes = format(attribute[:attributes], sub_record_table)

    yield(format_attribute_subrecs(label, sub_attributes))
  else
    expression = attribute[:expression]
    if expression
      yield(format_attribute_expression(label, expression))
    else
      column = table.column(source)
      if column
        yield(format_attribute_column(label, column))
      end
    end
  end
end