lib/include/class_customio.rb in knjappserver-0.0.16 vs lib/include/class_customio.rb in knjappserver-0.0.17

- old
+ new

@@ -1,35 +1,18 @@ class Knjappserver::CustomIO < StringIO def print(str) - thread = Thread.current str = str.to_s + appsrv = Thread.current[:knjappserver] - if thread and thread[:knjappserver] and thread[:knjappserver][:contentgroup] - httpsession = thread[:knjappserver][:httpsession] - - if httpsession - wsize = httpsession.written_size - wsize += str.size - - if wsize >= httpsession.size_send - httpsession.cgroup.write_output - end - end - - thread[:knjappserver][:contentgroup].write(str) + if appsrv and cgroup = appsrv[:contentgroup] and httpsession = appsrv[:httpsession] + httpsession.add_size(str.size) + cgroup.write(str) else STDOUT.print(str) if !STDOUT.closed? end end - def <<(str) - self.print(str) - end - - def write(str) - self.print(str) - end - - def p(str) - self.print(str) - end + alias << print + alias write print + alias p print + alias puts print end \ No newline at end of file