Method: Zstd::Decoder.open

Defined in:
lib/extzstd.rb

.open(inport, dict = nil) ⇒ Object

call-seq:

open(inport, dict = nil) -> decoder
open(inport, dict = nil) { |decoder| ... } -> yield returned value
inport

String instance or read method haved Object.



124
125
126
127
128
129
130
131
132
133
134
135
136
# File 'lib/extzstd.rb', line 124

def self.open(inport, dict = nil)
  inport = StringIO.new(inport) if inport.kind_of?(String)

  dec = new(inport, dict)

  return dec unless block_given?

  begin
    yield(dec)
  ensure
    dec.close rescue nil
  end
end