Class: Stretchy::Boosts::FilterBoost
- Defined in:
- lib/stretchy/boosts/filter_boost.rb
Constant Summary
Constants inherited from Base
Base::DEFAULT_DECAY_FN, Base::DEFAULT_WEIGHT
Constants included from Utils::Contract
Utils::Contract::ASSERTIONS, Utils::Contract::DECAY_FUNCTIONS, Utils::Contract::DISTANCE_FORMAT
Instance Attribute Summary collapse
-
#filter ⇒ Object
readonly
Returns the value of attribute filter.
-
#weight ⇒ Object
readonly
Returns the value of attribute weight.
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ FilterBoost
constructor
A new instance of FilterBoost.
- #to_search ⇒ Object
Methods included from Utils::Contract
included, #require_one, #validate!
Constructor Details
#initialize(options = {}) ⇒ FilterBoost
Returns a new instance of FilterBoost.
13 14 15 16 17 |
# File 'lib/stretchy/boosts/filter_boost.rb', line 13 def initialize( = {}) @filter = [:filter] @weight = [:weight] || DEFAULT_WEIGHT validate! end |
Instance Attribute Details
#filter ⇒ Object (readonly)
Returns the value of attribute filter.
8 9 10 |
# File 'lib/stretchy/boosts/filter_boost.rb', line 8 def filter @filter end |
#weight ⇒ Object (readonly)
Returns the value of attribute weight.
8 9 10 |
# File 'lib/stretchy/boosts/filter_boost.rb', line 8 def weight @weight end |
Instance Method Details
#to_search ⇒ Object
19 20 21 22 23 24 |
# File 'lib/stretchy/boosts/filter_boost.rb', line 19 def to_search { filter: @filter.to_search, weight: @weight } end |