Module: EasySearch

Defined in:
lib/easy_search/core.rb,
lib/easy_search/setup.rb,
lib/easy_search/errors.rb,
lib/easy_search/version.rb,
lib/easy_search/constants.rb,
lib/easy_search/validations.rb

Defined Under Namespace

Modules: ClassMethods, InstanceMethods Classes: Error, InvalidActiveRecordModel, InvalidDullKeywordsType, InvalidSettings, NoModelError, Setup, Validations

Constant Summary collapse

VERSION =
"0.1.0"
Regex =

holds any regexp constants when dealing with search terms

OpenStruct.new(
  :email => /(\w+@[a-zA-Z_]+?\.[a-zA-Z]{2,6})/
)
Defaults =
OpenStruct.new(
  # these keywords will be removed from any search terms, as they
  # provide no value and just increase the size of the query.
  # (the idea is a small attempt to be as efficient as possible)
  :dull_keywords => ['a', 'the', 'and', 'or', 'what', 'then', 'if', 'is', 'it']
)

Class Method Summary collapse

Class Method Details

.included(base) ⇒ Object



6
7
8
9
10
11
12
13
# File 'lib/easy_search/core.rb', line 6

def self.included(base)
  base.send(:extend,  ClassMethods)
  base.send(:include, InstanceMethods)
  
  # before continuing, validate that the models identified (if any) in the 
  # setup_tables block (within `Setup.config') exist and are valid ActiveRecord descendants
  Validations.validate_settings!
end