File: unknown.rb

package info (click to toggle)
ruby-zip 3.2.2-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 11,120 kB
  • sloc: ruby: 9,958; makefile: 23
file content (35 lines) | stat: -rw-r--r-- 644 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# frozen_string_literal: true

require_relative 'generic'

module Zip
  # A class to hold unknown extra fields so that they are preserved.
  class ExtraField::Unknown < ExtraField::Generic # :nodoc:
    def initialize
      @local_bin = +''
      @cdir_bin = +''
    end

    def merge(binstr, local: false)
      return if binstr.empty?

      if local
        @local_bin << binstr
      else
        @cdir_bin << binstr
      end
    end

    def to_local_bin
      @local_bin
    end

    def to_c_dir_bin
      @cdir_bin
    end

    def ==(other)
      @local_bin == other.to_local_bin && @cdir_bin == other.to_c_dir_bin
    end
  end
end