class SearchableBy::Config
Attributes
columns[R]
max_terms[RW]
min_length[RW]
options[R]
scoping[R]
Public Class Methods
new()
click to toggle source
# File lib/searchable_by/config.rb, line 6 def initialize @columns = [] @max_terms = 5 @min_length = 0 @options = {} scope { all } end
Public Instance Methods
column(*attrs, &block)
click to toggle source
# File lib/searchable_by/config.rb, line 26 def column(*attrs, &block) opts = attrs.extract_options! attrs.each do |attr| columns.push Column.new(attr, **@options, **opts) end columns.push Column.new(block, **@options, **opts) if block columns end
configure(max_terms, min_length, **options, &block)
click to toggle source
# File lib/searchable_by/config.rb, line 14 def configure(max_terms, min_length, **options, &block) instance_eval(&block) self.max_terms = max_terms if max_terms self.min_length = min_length self.options.update(options) unless options.empty? end
initialize_copy(other)
click to toggle source
Calls superclass method
# File lib/searchable_by/config.rb, line 21 def initialize_copy(other) @columns = other.columns.dup super end
scope(&block)
click to toggle source
# File lib/searchable_by/config.rb, line 35 def scope(&block) @scoping = block end