Sha256: b811d09c42a0015a7cc0a8effd89cbaa59549743c3f5b41aece001e8443f1eda

Contents?: true

Size: 651 Bytes

Versions: 9

Compression:

Stored size: 651 Bytes

Contents

class Knjappserver::CustomIO < StringIO
	def print(str)
		thread = Thread.current
		
    if thread and thread[:knjappserver] and thread[:knjappserver][:stringio] and !thread[:knjappserver][:stringio].closed?
      return thread[:knjappserver][:stringio].print(str)
		elsif thread and thread[:knjappserver] and thread[:knjappserver][:httpsession] and thread[:knjappserver][:httpsession].out and !thread[:knjappserver][:httpsession].out.closed?
			return thread[:knjappserver][:httpsession].out.print(str)
		else
			return STDOUT.print(str) if !STDOUT.closed?
		end
	end
	
	def <<(str)
		self.print(str)
	end
	
	def write(str)
		self.print(str)
	end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
knjappserver-0.0.15 lib/include/class_customio.rb
knjappserver-0.0.14 lib/include/class_customio.rb
knjappserver-0.0.13 lib/include/class_customio.rb
knjappserver-0.0.12 lib/include/class_customio.rb
knjappserver-0.0.11 lib/include/class_customio.rb
knjappserver-0.0.10 lib/include/class_customio.rb
knjappserver-0.0.9 lib/include/class_customio.rb
knjappserver-0.0.8 lib/include/class_customio.rb
knjappserver-0.0.6 lib/include/class_customio.rb