Class: Noaaish::Gunzip
- Inherits:
-
Object
- Object
- Noaaish::Gunzip
- Defined in:
- lib/noaaish/gunzip.rb
Instance Attribute Summary collapse
-
#input ⇒ Object
readonly
Returns the value of attribute input.
Instance Method Summary collapse
- #call ⇒ Object
- #destination ⇒ Object
-
#initialize(input, output = destination) ⇒ Gunzip
constructor
A new instance of Gunzip.
Constructor Details
#initialize(input, output = destination) ⇒ Gunzip
Returns a new instance of Gunzip.
10 11 12 13 |
# File 'lib/noaaish/gunzip.rb', line 10 def initialize(input, output=destination) @input = input @destination = output end |
Instance Attribute Details
#input ⇒ Object (readonly)
Returns the value of attribute input.
15 16 17 |
# File 'lib/noaaish/gunzip.rb', line 15 def input @input end |
Instance Method Details
#call ⇒ Object
17 18 19 20 21 |
# File 'lib/noaaish/gunzip.rb', line 17 def call zi = Zlib::Inflate.new(Zlib::MAX_WBITS + 32) destination << zi.inflate(input.read) destination end |
#destination ⇒ Object
23 24 25 |
# File 'lib/noaaish/gunzip.rb', line 23 def destination @destination ||= Tempfile.new('noaaish-gunzip') end |