module Elastics::Result::RailsHelper::Highlighter
Constants
- RE
Public Instance Methods
higlighted(attribute, opts={})
click to toggle source
TODO: add the doc for this method
# File lib/elastics/result/rails_helper.rb, line 21 def higlighted(attribute, opts={}) opts = { :fragment_separator => ' ... ' }.merge(opts) if self['highlight'] # works also with nested attributes key, high = self['highlight'].find { |k, v| k.gsub('.', '_') == attribute } high = Array.wrap(high) if high end if high.blank? respond_to?(attribute.to_sym) ? send(attribute.to_sym) : '' else high.join(opts[:fragment_separator]).html_safe end end
method_missing(meth, *args, &block)
click to toggle source
Calls superclass method
# File lib/elastics/result/rails_helper.rb, line 14 def method_missing(meth, *args, &block) meth.to_s =~ RE attribute = $1 attribute ? higlighted(attribute, args.first || {}) : super end
respond_to?(meth, private=false)
click to toggle source
Calls superclass method
# File lib/elastics/result/rails_helper.rb, line 9 def respond_to?(meth, private=false) meth.to_s =~ RE !!$1 || super end