Class: ThinkingSphinx::Excerpter
- Inherits:
-
Object
- Object
- ThinkingSphinx::Excerpter
- Defined in:
- lib/thinking_sphinx/excerpter.rb
Constant Summary collapse
- CoreMethods =
%w( kind_of? object_id respond_to? should should_not stub! )
Instance Method Summary collapse
-
#initialize(search, instance) ⇒ Excerpter
constructor
A new instance of Excerpter.
- #method_missing(method, *args, &block) ⇒ Object
Constructor Details
#initialize(search, instance) ⇒ Excerpter
Returns a new instance of Excerpter.
11 12 13 14 |
# File 'lib/thinking_sphinx/excerpter.rb', line 11 def initialize(search, instance) @search = search @instance = instance end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *args, &block) ⇒ Object
16 17 18 19 20 |
# File 'lib/thinking_sphinx/excerpter.rb', line 16 def method_missing(method, *args, &block) string = @instance.send(method, *args, &block).to_s @search.excerpt_for(string, @instance.class) end |