Sha256: f21874fc739fd71b7c9a886126663aaf69add183af250e394bc4ca26189aeb94
Contents?: true
Size: 660 Bytes
Versions: 38
Compression:
Stored size: 660 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 = CGI::escapeHTML @instance.send(method, *args, &block).to_s @search.excerpt_for(string, @instance.class) end end end
Version data entries
38 entries across 38 versions & 7 rubygems