class Kms::SearchItem
Constants
- HIGHLIGHTER
Attributes
content[R]
link[R]
title[R]
Public Class Methods
item_for_searchable(searchable, keywords, attributes_map)
click to toggle source
attributes_map for Kms::Page is: {title: :title, link: :fullpath, content: :content}
# File lib/kms/search_item.rb, line 35 def self.item_for_searchable(searchable, keywords, attributes_map) sanitized_title = ActionController::Base.helpers.sanitize(searchable[attributes_map[:title]]) sanitized_content = ActionController::Base.helpers.sanitize(searchable[attributes_map[:content]]) Kms::SearchItem.new( title: highlight(sanitized_title, keywords, highlighter: HIGHLIGHTER, sanitize: false), link: searchable[attributes_map[:link]], content: highlight(sanitized_content, keywords, highlighter: HIGHLIGHTER, sanitize: false) ) end
new(opts)
click to toggle source
# File lib/kms/search_item.rb, line 11 def initialize opts @title = opts[:title] @link = opts[:link] @content = opts[:content] end