Class: Recommendable::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/recommendable/configuration.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

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_enqueueObject

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_neighborsObject

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_neighborsObject

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

#ormObject

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_classesObject

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_storeObject

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

#redisObject

Recommendable’s connection to Redis.

Default: localhost:6379/0



11
12
13
# File 'lib/recommendable/configuration.rb', line 11

def redis
  @redis
end

#redis_namespaceObject

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_classObject

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_nameObject



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