Sha256: 949b8ba62b725c1ca097d4fb67db9b70b5e038bf185c7196091bf8e7fb3759b7

Contents?: true

Size: 1.03 KB

Versions: 78

Compression:

Stored size: 1.03 KB

Contents

module Zip
  class ExtraField::Generic
    def self.register_map
      if self.const_defined?(:HEADER_ID)
        ::Zip::ExtraField::ID_MAP[self.const_get(:HEADER_ID)] = self
      end
    end

    def self.name
      @name ||= self.to_s.split("::")[-1]
    end

    # return field [size, content] or false
    def initial_parse(binstr)
      if !binstr
        # If nil, start with empty.
        return false
      elsif binstr[0, 2] != self.class.const_get(:HEADER_ID)
        $stderr.puts "Warning: weired extra feild header ID. skip parsing"
        return false
      end
      [binstr[2, 2].unpack("v")[0], binstr[4..-1]]
    end

    def ==(other)
      return false if self.class != other.class
      each do |k, v|
        v != other[k] and return false
      end
      true
    end

    def to_local_bin
      s = pack_for_local
      self.class.const_get(:HEADER_ID) + [s.bytesize].pack("v") << s
    end

    def to_c_dir_bin
      s = pack_for_c_dir
      self.class.const_get(:HEADER_ID) + [s.bytesize].pack("v") << s
    end
  end
end

Version data entries

78 entries across 75 versions & 20 rubygems

Version Path
logstash-output-scalyr-0.2.1.beta vendor/bundle/jruby/2.5.0/gems/rubyzip-1.1.7/lib/zip/extra_field/generic.rb
logstash-output-scalyr-0.2.0 vendor/bundle/jruby/2.5.0/gems/rubyzip-1.1.7/lib/zip/extra_field/generic.rb
logstash-output-scalyr-0.2.0.beta vendor/bundle/jruby/2.5.0/gems/rubyzip-1.1.7/lib/zip/extra_field/generic.rb
logstash-output-scalyr-0.1.26.beta vendor/bundle/jruby/2.5.0/gems/rubyzip-1.1.7/lib/zip/extra_field/generic.rb
logstash-output-scalyr-0.1.25.beta vendor/bundle/jruby/2.5.0/gems/rubyzip-1.1.7/lib/zip/extra_field/generic.rb
logstash-output-scalyr-0.1.24.beta vendor/bundle/jruby/2.5.0/gems/rubyzip-1.1.7/lib/zip/extra_field/generic.rb
logstash-output-scalyr-0.1.23.beta vendor/bundle/jruby/2.5.0/gems/rubyzip-1.1.7/lib/zip/extra_field/generic.rb
logstash-output-scalyr-0.1.22.beta vendor/bundle/jruby/2.5.0/gems/rubyzip-1.1.7/lib/zip/extra_field/generic.rb
logstash-output-scalyr-0.1.21.beta vendor/bundle/jruby/2.5.0/gems/rubyzip-1.1.7/lib/zip/extra_field/generic.rb
logstash-output-scalyr-0.1.20.beta vendor/bundle/jruby/2.5.0/gems/rubyzip-1.1.7/lib/zip/extra_field/generic.rb
logstash-output-scalyr-0.1.19.beta vendor/bundle/jruby/2.5.0/gems/rubyzip-1.1.7/lib/zip/extra_field/generic.rb
logstash-output-scalyr-0.1.18.beta vendor/bundle/jruby/2.5.0/gems/rubyzip-1.1.7/lib/zip/extra_field/generic.rb
logstash-output-scalyr-0.1.17.beta vendor/bundle/jruby/2.5.0/gems/rubyzip-1.1.7/lib/zip/extra_field/generic.rb
logstash-output-scalyr-0.1.16.beta vendor/bundle/jruby/2.5.0/gems/rubyzip-1.1.7/lib/zip/extra_field/generic.rb
logstash-output-scalyr-0.1.15.beta vendor/bundle/jruby/2.5.0/gems/rubyzip-1.1.7/lib/zip/extra_field/generic.rb
logstash-output-scalyr-0.1.14.beta vendor/bundle/jruby/2.5.0/gems/rubyzip-1.1.7/lib/zip/extra_field/generic.rb
logstash-output-scalyr-0.1.13 vendor/bundle/jruby/2.5.0/gems/rubyzip-1.1.7/lib/zip/extra_field/generic.rb
logstash-output-scalyr-0.1.12 vendor/bundle/jruby/2.5.0/gems/rubyzip-1.1.7/lib/zip/extra_field/generic.rb
logstash-output-scalyr-0.1.11.beta vendor/bundle/jruby/2.5.0/gems/rubyzip-1.1.7/lib/zip/extra_field/generic.rb
logstash-output-scalyr-0.1.10.beta vendor/bundle/jruby/2.5.0/gems/rubyzip-1.1.7/lib/zip/extra_field/generic.rb