lib/logstasher/device/redis.rb in logstasher-1.4.0 vs lib/logstasher/device/redis.rb in logstasher-2.0.0

- old
+ new

@@ -1,11 +1,10 @@ require 'redis' module LogStasher module Device class Redis - attr_reader :options, :redis def initialize(options = {}) @options = default_options.merge(options) validate_options @@ -21,11 +20,11 @@ end def redis_options unless @redis_options default_keys = default_options.keys - @redis_options = options.select { |k, v| !default_keys.include?(k) } + @redis_options = options.select { |k, _v| !default_keys.include?(k) } end @redis_options end @@ -34,11 +33,11 @@ when 'list' redis.rpush(key, log) when 'channel' redis.publish(key, log) else - fail "Unknown data type #{data_type}" + raise "Unknown data type #{data_type}" end end def close redis.quit @@ -49,15 +48,15 @@ def configure_redis @redis = ::Redis.new(redis_options) end def default_options - { key: 'logstash', data_type: 'list' } + { key: 'logstash', data_type: 'list' } end def validate_options - unless ['list', 'channel'].include?(options[:data_type]) - fail 'Expected :data_type to be either "list" or "channel"' + unless %w[list channel].include?(options[:data_type]) + raise 'Expected :data_type to be either "list" or "channel"' end end end end end