Sha256: c8223645aab7e116c7656320557a8de6a0141f734971361f6c22cd990db2da7f
Contents?: true
Size: 446 Bytes
Versions: 5
Compression:
Stored size: 446 Bytes
Contents
class ExportToRedis include UseCasePattern validates :hit, presence: true def initialize(hit:) @hit = hit end def perform redis.lpush("usage_hits", serialised_hit) disconnect_redis end private attr_reader :hit def redis @redis ||= Redis.new(host: "127.0.0.1", port: 6379) end def disconnect_redis redis.quit @redis = nil end def serialised_hit JSON.generate(hit.attributes) end end
Version data entries
5 entries across 5 versions & 1 rubygems