Class: Autoselect::Otu::Autoselect
- Includes:
- Operators
- Defined in:
- lib/autoselect/otu/autoselect.rb
Constant Summary
Constants included from Autoselect::Operators
Autoselect::Operators::OPERATORS
Instance Attribute Summary
Attributes inherited from Base
#level_params, #project_id, #raw_term, #requested_level, #user_id
Instance Method Summary collapse
-
#format_results(records, level_instance) ⇒ Object
private
Override to handle new-OTU sentinel (extension with :_otu_new_form) and CoL results (extension with :_col_extension).
-
#levels ⇒ Object
Ordered level stack — defines the fuse escalation sequence.
- #resource_path ⇒ Object
-
#response_values(record) ⇒ Hash
Key-value pairs injected into the parent form on selection.
Methods included from Operators
Methods inherited from Base
#build_config, #config_response, #execute_level, #find_level, #initialize, #level_map_keys, #next_level_key, #record_list_operator?, #response, #term_response
Methods included from Autoselect::Operators
Constructor Details
This class inherits a constructor from Autoselect::Base
Instance Method Details
#format_results(records, level_instance) ⇒ Object (private)
Override to handle new-OTU sentinel (extension with :_otu_new_form) and CoL results (extension with :_col_extension).
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/autoselect/otu/autoselect.rb', line 30 def format_results(records, level_instance) records.map do |record| ext = {} ext = record._otu_new_form if record.respond_to?(:_otu_new_form) && record._otu_new_form ext = record._col_extension if record.respond_to?(:_col_extension) && record._col_extension { id: record.id, global_id: record.respond_to?(:to_global_id) ? record.to_global_id.to_s : nil, label: level_instance.record_label(record), label_html: level_instance.record_label_html(record), info_html: @show_info ? level_instance.record_info_html(record) : '', response_values: response_values(record), extension: ext } end end |
#levels ⇒ Object
Ordered level stack — defines the fuse escalation sequence.
12 13 14 15 16 17 18 |
# File 'lib/autoselect/otu/autoselect.rb', line 12 def levels [ ::Autoselect::Otu::Levels::Fast.new, ::Autoselect::Otu::Levels::Smart.new, ::Autoselect::Otu::Levels::CatalogueOfLife.new, ] end |
#resource_path ⇒ Object
7 8 9 |
# File 'lib/autoselect/otu/autoselect.rb', line 7 def resource_path '/otus/autoselect' end |
#response_values(record) ⇒ Hash
Returns key-value pairs injected into the parent form on selection.
22 23 24 |
# File 'lib/autoselect/otu/autoselect.rb', line 22 def response_values(record) { otu_id: record.id } end |