Sha256: 671016acdb22d3b805e052a2fae038594084738eef88633e2798a704309fbfe8

Contents?: true

Size: 658 Bytes

Versions: 3

Compression:

Stored size: 658 Bytes

Contents

class ThinkingSphinx::Search::Glaze < BasicObject
  def initialize(context, object, raw = {}, pane_classes = [])
    @object, @raw = object, raw

    @panes = pane_classes.collect { |klass|
      klass.new context, object, @raw
    }
  end

  def ==(object)
    (@object == object) || super
  end

  def equal?(object)
    @object.equal? object
  end

  def unglazed
    @object
  end

  private

  def method_missing(method, *args, &block)
    pane = @panes.detect { |pane| pane.respond_to?(method) }
    if @object.respond_to?(method) || pane.nil?
      @object.send(method, *args, &block)
    else
      pane.send(method, *args, &block)
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
thinking-sphinx-3.0.3 lib/thinking_sphinx/search/glaze.rb
thinking-sphinx-3.0.2 lib/thinking_sphinx/search/glaze.rb
thinking-sphinx-3.0.1 lib/thinking_sphinx/search/glaze.rb