File tree Expand file tree Collapse file tree 2 files changed +10
-6
lines changed
Expand file tree Collapse file tree 2 files changed +10
-6
lines changed Original file line number Diff line number Diff line change 11require_relative 'no_redis_error'
2-
3- begin
4- require 'redis'
5- rescue LoadError
6- raise NoRedisError
7- end
2+ # require redis when we run #intialize. This way only people using this backend
3+ # will need to install and load the backend without having to
4+ # require 'classifier-reborn/backends/bayes_redis_backend'
85
96module ClassifierReborn
107 # This class provides Redis as the storage backend for the classifier data structures
@@ -30,6 +27,12 @@ class BayesRedisBackend
3027 # reconnect_attempts: 1
3128 # inherit_socket: false
3229 def initialize ( options = { } )
30+ begin # because some people don't have redis installed
31+ require 'redis'
32+ rescue LoadError
33+ raise NoRedisError
34+ end
35+
3336 @redis = Redis . new ( options )
3437 @redis . set ( :total_words , 0 )
3538 @redis . set ( :total_trainings , 0 )
Original file line number Diff line number Diff line change 66
77require_relative 'category_namer'
88require_relative 'backends/bayes_memory_backend'
9+ require_relative 'backends/bayes_redis_backend'
910
1011module ClassifierReborn
1112 class Bayes
You can’t perform that action at this time.
0 commit comments