Class: Recommendable::Configuration
- Inherits:
-
Object
- Object
- Recommendable::Configuration
- Defined in:
- lib/recommendable/configuration.rb
Instance Attribute Summary collapse
-
#auto_enqueue ⇒ Object
Whether or not to automatically enqueue users to have their recommendations refreshed after they like/dislike an item.
-
#furthest_neighbors ⇒ Object
Like kNN, but also uses some number of most dissimilar users when updating recommendations for a user.
-
#nearest_neighbors ⇒ Object
The number of nearest neighbors (k-NN) to check when updating recommendations for a user.
-
#orm ⇒ Object
The ORM you are using.
-
#ratable_classes ⇒ Object
Returns the value of attribute ratable_classes.
-
#recommendations_to_store ⇒ Object
The number of recommendations to store per user.
-
#redis ⇒ Object
Recommendable’s connection to Redis.
-
#redis_namespace ⇒ Object
A prefix for all keys Recommendable uses.
-
#user_class ⇒ Object
Returns the value of attribute user_class.
Instance Method Summary collapse
-
#initialize ⇒ Configuration
constructor
Default values.
- #queue_name ⇒ Object
- #queue_name=(queue_name) ⇒ Object
Constructor Details
#initialize ⇒ Configuration
Default values
50 51 52 53 54 55 56 57 58 |
# File 'lib/recommendable/configuration.rb', line 50 def initialize @redis = Redis.new @redis_namespace = :recommendable @auto_enqueue = true @ratable_classes = [] @nearest_neighbors = nil @furthest_neihbors = nil @recommendations_to_store = 100 end |
Instance Attribute Details
#auto_enqueue ⇒ Object
Whether or not to automatically enqueue users to have their recommendations refreshed after they like/dislike an item.
Default: true
22 23 24 |
# File 'lib/recommendable/configuration.rb', line 22 def auto_enqueue @auto_enqueue end |
#furthest_neighbors ⇒ Object
Like kNN, but also uses some number of most dissimilar users when updating recommendations for a user. Because, hey, disagreements are just as important as agreements, right? If ‘nearest_neighbors` is set to `nil`, this configuration is ignored. Set this to a lower number to improve Redis memory usage.
Default: nil
39 40 41 |
# File 'lib/recommendable/configuration.rb', line 39 def furthest_neighbors @furthest_neighbors end |
#nearest_neighbors ⇒ Object
The number of nearest neighbors (k-NN) to check when updating recommendations for a user. Set to ‘nil` if you want to check all neighbors as opposed to a subset of the nearest ones. Set this to a lower number to improve Redis memory usage.
Default: nil
30 31 32 |
# File 'lib/recommendable/configuration.rb', line 30 def nearest_neighbors @nearest_neighbors end |
#orm ⇒ Object
The ORM you are using. Currently supported: ‘:activerecord`, `:mongoid`, ’:sequel’, ‘:mongo-mapper’ and ‘:datamapper`
6 7 8 |
# File 'lib/recommendable/configuration.rb', line 6 def orm @orm end |
#ratable_classes ⇒ Object
Returns the value of attribute ratable_classes.
47 48 49 |
# File 'lib/recommendable/configuration.rb', line 47 def ratable_classes @ratable_classes end |
#recommendations_to_store ⇒ Object
The number of recommendations to store per user. Set this to a lower number to improve Redis memory usage.
Default: 100
45 46 47 |
# File 'lib/recommendable/configuration.rb', line 45 def recommendations_to_store @recommendations_to_store end |
#redis ⇒ Object
Recommendable’s connection to Redis.
Default: localhost:6379/0
11 12 13 |
# File 'lib/recommendable/configuration.rb', line 11 def redis @redis end |
#redis_namespace ⇒ Object
A prefix for all keys Recommendable uses.
Default: recommendable
16 17 18 |
# File 'lib/recommendable/configuration.rb', line 16 def redis_namespace @redis_namespace end |
#user_class ⇒ Object
Returns the value of attribute user_class.
47 48 49 |
# File 'lib/recommendable/configuration.rb', line 47 def user_class @user_class end |
Instance Method Details
#queue_name ⇒ Object
60 61 62 |
# File 'lib/recommendable/configuration.rb', line 60 def queue_name warn "Recommendable.config.queue_name has been deprecated. Jobs will always be placed in a queue named 'recommendable'." end |
#queue_name=(queue_name) ⇒ Object
64 65 66 |
# File 'lib/recommendable/configuration.rb', line 64 def queue_name=(queue_name) warn "Recommendable.config.queue_name has been deprecated. Jobs will always be placed in a queue named 'recommendable'." end |