Class: Backend

Inherits:
Object
  • Object
show all
Defined in:
lib/engine/app/lib/backend.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(opts = {}) ⇒ Backend

Returns a new instance of Backend.



6
7
8
9
10
# File 'lib/engine/app/lib/backend.rb', line 6

def initialize(opts = {})
  @host = opts[:host]
  @port = opts[:port]
  @current_database = opts[:current_database]
end

Instance Attribute Details

#current_databaseObject

Returns the value of attribute current_database.



2
3
4
# File 'lib/engine/app/lib/backend.rb', line 2

def current_database
  @current_database
end

#hostObject

Returns the value of attribute host.



2
3
4
# File 'lib/engine/app/lib/backend.rb', line 2

def host
  @host
end

#portObject

Returns the value of attribute port.



2
3
4
# File 'lib/engine/app/lib/backend.rb', line 2

def port
  @port
end

Instance Method Details

#redisObject



12
13
14
15
16
# File 'lib/engine/app/lib/backend.rb', line 12

def redis
  @redis ||= Redis.new(host: host, port: port)
  @redis.select(current_database)
  @redis
end