Sha256: 13b9cf3b0e647abd587cf42260af88db0158150f982e6f505692731bb300795c

Contents?: true

Size: 644 Bytes

Versions: 49

Compression:

Stored size: 644 Bytes

Contents

module ThinkingSphinx
  class Excerpter
    CoreMethods = %w( kind_of? object_id respond_to? should should_not stub! )
    # Hide most methods, to allow them to be passed through to the instance.
    instance_methods.select { |method|
      method.to_s[/^__/].nil? && !CoreMethods.include?(method.to_s)
    }.each { |method|
      undef_method method
    }
    
    def initialize(search, instance)
      @search   = search
      @instance = instance
    end
    
    def method_missing(method, *args, &block)
      string = @instance.send(method, *args, &block).to_s
      
      @search.excerpt_for(string, @instance.class)
    end
  end
end

Version data entries

49 entries across 49 versions & 15 rubygems

Version Path
DrMark-thinking-sphinx-1.2.5 lib/thinking_sphinx/excerpter.rb
DrMark-thinking-sphinx-1.2.6 lib/thinking_sphinx/excerpter.rb
bterlson-thinking-sphinx-1.2.8 lib/thinking_sphinx/excerpter.rb
ebeigarts-thinking-sphinx-1.2.10 lib/thinking_sphinx/excerpter.rb
factorylabs-thinking-sphinx-1.2.7 lib/thinking_sphinx/excerpter.rb
freelancing-god-thinking-sphinx-1.2.0 lib/thinking_sphinx/excerpter.rb
freelancing-god-thinking-sphinx-1.2.1 lib/thinking_sphinx/excerpter.rb
freelancing-god-thinking-sphinx-1.2.10 lib/thinking_sphinx/excerpter.rb
freelancing-god-thinking-sphinx-1.2.11 lib/thinking_sphinx/excerpter.rb
freelancing-god-thinking-sphinx-1.2.2 lib/thinking_sphinx/excerpter.rb
freelancing-god-thinking-sphinx-1.2.3 lib/thinking_sphinx/excerpter.rb
freelancing-god-thinking-sphinx-1.2.4 lib/thinking_sphinx/excerpter.rb
freelancing-god-thinking-sphinx-1.2.5 lib/thinking_sphinx/excerpter.rb
freelancing-god-thinking-sphinx-1.2.6 lib/thinking_sphinx/excerpter.rb
freelancing-god-thinking-sphinx-1.2.7 lib/thinking_sphinx/excerpter.rb
freelancing-god-thinking-sphinx-1.2.8 lib/thinking_sphinx/excerpter.rb
freelancing-god-thinking-sphinx-1.2.9 lib/thinking_sphinx/excerpter.rb
hariton-thinking-sphinx-1.2.11.2 lib/thinking_sphinx/excerpter.rb
hariton-thinking-sphinx-1.2.11 lib/thinking_sphinx/excerpter.rb
hariton-thinking-sphinx-1.2.7.0 lib/thinking_sphinx/excerpter.rb