Sha256: 44ed0631cc78ee238379cd770f996e9339e7f535cc0cb8b1426e892e2c4bcc01
Contents?: true
Size: 859 Bytes
Versions: 2
Compression:
Stored size: 859 Bytes
Contents
module LogStasher module Device def self.factory(config) config = stringify_keys(config) type = config.delete('type') or fail ArgumentError, 'No "type" given' case type when 'redis', :redis then require 'logstasher/device/redis' ::LogStasher::Device::Redis.new(config) when "syslog", :syslog then require 'logstasher/device/syslog' ::LogStasher::Device::Syslog.new(config) when "udp", :udp then require 'logstasher/device/udp' ::LogStasher::Device::UDP.new(config) else fail ArgumentError, "Unknown type: #{type}" end end def stringify_keys(hash) hash.inject({}) do |stringified_hash, (key, value)| stringified_hash[key.to_s] = value stringified_hash end end module_function :stringify_keys end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
md-logstasher-1.4.0 | lib/logstasher/device.rb |
md-logstasher-1.3.0 | lib/logstasher/device.rb |