Method: Krypt::IOFilter#initialize

Defined in:
lib/krypt/codec.rb

#initialize(io) ⇒ IOFilter

call-seq:

IOFilter.new(io) [{ |filter| block }] -> IOFilter

Constructs a new IOFilter with io as its underlying IO. Takes an optional block which is yielded the IOFilter filter. After execution of the block, it is guaranteed that IOFilter#close gets called on the IOFilter.



30
31
32
33
34
35
36
37
38
39
# File 'lib/krypt/codec.rb', line 30

def initialize(io)
  @io = io
  if block_given?
    begin
      yield self
    ensure
      close
    end
  end
end