Class: Droonga::Searcher::SimpleAttributesFormatter
- Inherits:
-
Object
- Object
- Droonga::Searcher::SimpleAttributesFormatter
- Includes:
- AttributeFormattable
- Defined in:
- lib/droonga/searcher.rb
Instance Method Summary collapse
- #format(attributes, table) ⇒ Object
- #format_attribute_column(label, column) ⇒ Object
- #format_attribute_expression(label, expression) ⇒ Object
- #format_attribute_subrecs(label, sub_attributes) ⇒ Object
Methods included from AttributeFormattable
Instance Method Details
#format(attributes, table) ⇒ Object
504 505 506 507 508 509 510 511 512 |
# File 'lib/droonga/searcher.rb', line 504 def format(attributes, table) formatted_attributes = [] attributes.each do |attribute| format_attribute(attribute, table) do |formatted_attribute| formatted_attributes << formatted_attribute end end formatted_attributes end |
#format_attribute_column(label, column) ⇒ Object
495 496 497 498 |
# File 'lib/droonga/searcher.rb', line 495 def format_attribute_column(label, column) vector = column.respond_to?(:vector?) ? column.vector? : false {"name" => label, "type" => column.range.name, "vector" => vector} end |
#format_attribute_expression(label, expression) ⇒ Object
500 501 502 |
# File 'lib/droonga/searcher.rb', line 500 def format_attribute_expression(label, expression) {"name" => label} # TODO include detailed information of expression end |
#format_attribute_subrecs(label, sub_attributes) ⇒ Object
488 489 490 491 492 493 |
# File 'lib/droonga/searcher.rb', line 488 def format_attribute_subrecs(label, sub_attributes) { "name" => label, "attributes" => sub_attributes, } end |