Class: Zinzout::ZinFile
- Inherits:
-
Object
- Object
- Zinzout::ZinFile
- Defined in:
- lib/zinzout.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#io ⇒ Object
readonly
Returns the value of attribute io.
Instance Method Summary collapse
- #close ⇒ Object
-
#initialize(filename, encoding) ⇒ ZinFile
constructor
A new instance of ZinFile.
- #io_from_file(filename, encoding) ⇒ Object
Constructor Details
#initialize(filename, encoding) ⇒ ZinFile
Returns a new instance of ZinFile.
53 54 55 |
# File 'lib/zinzout.rb', line 53 def initialize(filename, encoding) @io = io_from_file(filename, encoding) end |
Instance Attribute Details
#io ⇒ Object (readonly)
Returns the value of attribute io.
51 52 53 |
# File 'lib/zinzout.rb', line 51 def io @io end |
Instance Method Details
#close ⇒ Object
63 64 65 |
# File 'lib/zinzout.rb', line 63 def close @io.close end |
#io_from_file(filename, encoding) ⇒ Object
57 58 59 60 61 |
# File 'lib/zinzout.rb', line 57 def io_from_file(filename, encoding) Zlib::GzipReader.open(filename, encoding: encoding) rescue Zlib::GzipFile::Error ::File.open(filename, 'r', encoding: encoding) end |