Module: Bluecap
- Extended by:
- Bluecap
- Included in:
- Bluecap
- Defined in:
- lib/bluecap.rb,
lib/bluecap/keys.rb,
lib/bluecap/cohort.rb,
lib/bluecap/server.rb,
lib/bluecap/message.rb,
lib/bluecap/engagement.rb,
lib/bluecap/handlers/event.rb,
lib/bluecap/handlers/report.rb,
lib/bluecap/handlers/identify.rb,
lib/bluecap/handlers/attributes.rb,
lib/bluecap/handlers/null_handler.rb
Defined Under Namespace
Modules: Keys, Server Classes: Attributes, Cohort, Engagement, Event, Identify, Message, NullHandler, Report
Instance Method Summary collapse
-
#host ⇒ Object
Returns the String host to bind to.
-
#host=(host) ⇒ Object
Set the host to bind to.
-
#log(message) ⇒ Object
Log a message to STDOUT.
-
#port ⇒ Object
Returns the Integer port to bind to.
-
#port=(port) ⇒ Object
Set the port to bind to.
-
#redis ⇒ Object
Returns the Redis client, creating a new client if one does not already exist.
-
#redis=(server) ⇒ Object
Connect to Redis and store the resulting client.
Instance Method Details
#host ⇒ Object
Returns the String host to bind to.
50 51 52 53 54 |
# File 'lib/bluecap.rb', line 50 def host return @host if @host self.host = '0.0.0.0' self.host end |
#host=(host) ⇒ Object
Set the host to bind to.
Returns nothing.
45 46 47 |
# File 'lib/bluecap.rb', line 45 def host=(host) @host = host end |
#log(message) ⇒ Object
Log a message to STDOUT.
Returns nothing.
73 74 75 76 |
# File 'lib/bluecap.rb', line 73 def log() time = Time.now.strftime('%Y-%m-%d %H:%M:%S') puts "#{time} - #{}" end |
#port ⇒ Object
Returns the Integer port to bind to.
64 65 66 67 68 |
# File 'lib/bluecap.rb', line 64 def port return @port if @port self.port = 6088 self.port end |
#port=(port) ⇒ Object
Set the port to bind to.
Returns nothing.
59 60 61 |
# File 'lib/bluecap.rb', line 59 def port=(port) @port = port end |
#redis ⇒ Object
Returns the Redis client, creating a new client if one does not already exist.
36 37 38 39 40 |
# File 'lib/bluecap.rb', line 36 def redis return @redis if @redis self.redis = 'localhost:6379' self.redis end |
#redis=(server) ⇒ Object
Connect to Redis and store the resulting client.
server - A String of conncetion details in host:port format.
Examples
redis = 'localhost:6379'
Returns nothing.
29 30 31 32 |
# File 'lib/bluecap.rb', line 29 def redis=(server) host, port, database = server.split(':') @redis = Redis.new(host: host, port: port, database: database) end |