Class: DataLogger::Sinks::STDOUT

Inherits:
Object
  • Object
show all
Defined in:
lib/datalogger/sinks/stdout.rb

Instance Method Summary collapse

Constructor Details

#initialize(sync = true) ⇒ STDOUT

Returns a new instance of STDOUT.



4
5
6
# File 'lib/datalogger/sinks/stdout.rb', line 4

def initialize(sync=true)
  ::STDOUT.sync = sync
end

Instance Method Details

#log(component, data) ⇒ Object



12
13
14
# File 'lib/datalogger/sinks/stdout.rb', line 12

def log(component, data)
  puts "#{component} #{stringify_data(data)}"
end

#stringify_data(data) ⇒ Object



8
9
10
# File 'lib/datalogger/sinks/stdout.rb', line 8

def stringify_data(data)
  data.inject("") { |s, (k,v)| s + "#{k}=#{v} " }.strip
end