Class: MultiMovingsign::TeeIO
- Inherits:
-
IO
- Object
- IO
- MultiMovingsign::TeeIO
- Defined in:
- lib/multi_movingsign/server.rb
Overview
Instance Attribute Summary collapse
-
#destinations ⇒ Object
Returns the value of attribute destinations.
Instance Method Summary collapse
-
#initialize(*dests) ⇒ TeeIO
constructor
A new instance of TeeIO.
- #puts(val) ⇒ Object
- #write(val) ⇒ Object
Constructor Details
#initialize(*dests) ⇒ TeeIO
Returns a new instance of TeeIO.
12 13 14 |
# File 'lib/multi_movingsign/server.rb', line 12 def initialize(*dests) self.destinations = dests end |
Instance Attribute Details
#destinations ⇒ Object
Returns the value of attribute destinations.
10 11 12 |
# File 'lib/multi_movingsign/server.rb', line 10 def destinations @destinations end |
Instance Method Details
#puts(val) ⇒ Object
16 17 18 19 20 21 22 |
# File 'lib/multi_movingsign/server.rb', line 16 def puts(val) time = Time.now destinations.each do |d| d.puts "#{time}: #{val.to_s}" d.flush end end |
#write(val) ⇒ Object
24 25 26 27 28 29 |
# File 'lib/multi_movingsign/server.rb', line 24 def write(val) destinations.each do |d| d.write val d.flush end end |