Module: Zinzout

Defined in:
lib/zinzout.rb,
lib/zinzout/version.rb

Defined Under Namespace

Classes: Error, Zin, ZinFile, ZinStdin, Zout, ZoutFile, ZoutStdout

Constant Summary collapse

DEFAULT_ENCODING =
"utf-8"
VERSION =
"0.1.1"

Class Method Summary collapse

Class Method Details

.zin(filename = nil, encoding: DEFAULT_ENCODING) ⇒ Object



9
10
11
12
13
14
15
16
# File 'lib/zinzout.rb', line 9

def self.zin(filename = nil, encoding: DEFAULT_ENCODING)
  zin = Zin.new(filename, encoding)
  if block_given?
    yield zin.io
    zin.close
  end
  zin.io
end

.zout(filename = nil, encoding: DEFAULT_ENCODING) ⇒ Object



18
19
20
21
22
23
24
25
26
27
# File 'lib/zinzout.rb', line 18

def self.zout(filename = nil, encoding: DEFAULT_ENCODING)
  zout = Zout.new(filename, encoding)
  if block_given?
    yield zout.io
    zout.close
    nil
  else
    zout.io
  end
end