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-filter-cache-redis-0.1.0 vendor/bundle/jruby/1.9/gems/rubyzip-1.1.7/lib/zip/extra_field/generic.rb
logstash-filter-csharp-0.1.0 vendor/bundle/jruby/2.3.0/gems/rubyzip-1.1.7/lib/zip/extra_field/generic.rb
logstash-filter-htmlentities-0.1.0 vendor/bundle/jruby/1.9/gems/rubyzip-1.1.7/lib/zip/extra_field/generic.rb
logstash-output-icinga-1.0.0 vendor/jruby/1.9/gems/rubyzip-1.1.7/lib/zip/extra_field/generic.rb
logstash-filter-zabbix-0.1.2 vendor/bundle/jruby/1.9/gems/rubyzip-1.1.7/lib/zip/extra_field/generic.rb
logstash-filter-zabbix-0.1.1 vendor/bundle/jruby/1.9/gems/rubyzip-1.1.7/lib/zip/extra_field/generic.rb
logstash-input-fifo-0.9.1 vendor/bundle/jruby/1.9/gems/rubyzip-1.1.7/lib/zip/extra_field/generic.rb
logstash-input-fifo-0.9.0 vendor/bundle/jruby/1.9/gems/rubyzip-1.1.7/lib/zip/extra_field/generic.rb
logstash-input-salesforce-3.0.0 vendor/jruby/1.9/gems/rubyzip-1.1.7/lib/zip/extra_field/generic.rb
ivanvc-logstash-input-s3-3.1.1.4 vendor/local/gems/rubyzip-1.1.7/lib/zip/extra_field/generic.rb
ivanvc-logstash-input-s3-3.1.1.3 vendor/local/gems/rubyzip-1.1.7/lib/zip/extra_field/generic.rb
ivanvc-logstash-input-s3-3.1.1.2 vendor/local/gems/rubyzip-1.1.7/lib/zip/extra_field/generic.rb
logstash-filter-delta-1.1.0 vendor/bundle/jruby/2.2.0/gems/rubyzip-1.1.7/lib/zip/extra_field/generic.rb
logstash-filter-delta-1.0.1 vendor/bundle/jruby/2.2.0/gems/rubyzip-1.1.7/lib/zip/extra_field/generic.rb
logstash-filter-base64-1.0.4 vendor/bundle/jruby/2.2.0/gems/rubyzip-1.1.7/lib/zip/extra_field/generic.rb
logstash-filter-base64-1.0.3 vendor/bundle/jruby/2.2.0/gems/rubyzip-1.1.7/lib/zip/extra_field/generic.rb
logstash-filter-delta-1.0.0 vendor/bundle/jruby/2.2.0/gems/rubyzip-1.1.7/lib/zip/extra_field/generic.rb
logstash-filter-base64-1.0.2 vendor/bundle/jruby/2.3.0/gems/rubyzip-1.1.7/lib/zip/extra_field/generic.rb
logstash-filter-base64-1.0.1 vendor/bundle/jruby/2.3.0/gems/rubyzip-1.1.7/lib/zip/extra_field/generic.rb
logstash-filter-base64-1.0.0 vendor/bundle/jruby/2.3.0/gems/rubyzip-1.1.7/lib/zip/extra_field/generic.rb