Sha256: ad8441566f6a49cb17b17436aa12ac03cda3d5ef53f737afe20553618cf88ecb
Contents?: true
Size: 796 Bytes
Versions: 2
Compression:
Stored size: 796 Bytes
Contents
# frozen_string_literal: true class ThinkingSphinx::Middlewares::Glazier < ThinkingSphinx::Middlewares::Middleware def call(contexts) contexts.each do |context| Inner.new(context).call end app.call contexts end private class Inner def initialize(context) @context = context end def call return if context[:panes].empty? context[:results] = context[:results].collect { |result| ThinkingSphinx::Search::Glaze.new context, result, row_for(result), context[:panes] } end private attr_reader :context def row_for(result) context[:raw].detect { |row| row['sphinx_internal_class'] == result.class.name && row['sphinx_internal_id'] == result.id } end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
thinking-sphinx-4.1.0 | lib/thinking_sphinx/middlewares/glazier.rb |
thinking-sphinx-4.0.0 | lib/thinking_sphinx/middlewares/glazier.rb |