lib/rio/stream/open.rb in rio-0.3.6 vs lib/rio/stream/open.rb in rio-0.3.7
- old
+ new
@@ -79,21 +79,21 @@
end
end
end
-
+require 'rio/util'
module RIO
module Stream
class Open < Base
def size()
self.contents.size
end
- OUTPUT_SYMS = [:print,:printf,:puts,:putc,:write,
- :print!,:printf!,:puts!,:putc!,:write!,
- :put_,:putrec,:putrec!,:<,:<<
- ].build_hash { |sym| [sym.to_s,1] }
+ OUTPUT_SYMS = Util::build_sym_hash([:print,:printf,:puts,:putc,:write,
+ :print!,:printf!,:puts!,:putc!,:write!,
+ :put_,:putrec,:putrec!,:<,:<< ])
+
def sym_state(sym,im,om)
if OUTPUT_SYMS[sym.to_s] or RIO::Ext::OUTPUT_SYMS[sym.to_s]
om ||= (sym.to_s == '<<' ? 'a' : 'w')
#p "HEREHEREHERE om=#{om.inspect}"
mode_(om).open_.output()
@@ -190,13 +190,16 @@
return self unless self.open?
self.close_
cx['retrystate'] = nil
self
end
- def getrec()
+ def get()
self.close_.softreset
nil
end
+ alias :getline :get
+ alias :getrow :get
+ alias :getrec :get
def check?() true end
def base_state() 'Stream::Reset' end
def when_missing(sym,*args)
# p callstr('when_missing',sym,*args)