Class: Zip::ExtraField::Generic
- Inherits:
-
Object
- Object
- Zip::ExtraField::Generic
show all
- Defined in:
- lib/zip/extra_field/generic.rb
Overview
Class Method Summary
collapse
Instance Method Summary
collapse
Class Method Details
.name ⇒ Object
11
12
13
|
# File 'lib/zip/extra_field/generic.rb', line 11
def self.name
@name ||= to_s.split('::')[-1]
end
|
.register_map ⇒ Object
5
6
7
8
9
|
# File 'lib/zip/extra_field/generic.rb', line 5
def self.register_map
return unless const_defined?(:HEADER_ID)
::Zip::ExtraField::ID_MAP[const_get(:HEADER_ID)] = self
end
|
Instance Method Details
#initial_parse(binstr) ⇒ Object
return field [size, content] or false
16
17
18
19
20
21
22
23
24
25
|
# File 'lib/zip/extra_field/generic.rb', line 16
def initial_parse(binstr)
return false unless binstr
if binstr[0, 2] != self.class.const_get(:HEADER_ID)
warn 'WARNING: weird extra field header ID. Skip parsing it.'
return false
end
[binstr[2, 2].unpack1('v'), binstr[4..]]
end
|
#to_c_dir_bin ⇒ Object
32
33
34
35
|
# File 'lib/zip/extra_field/generic.rb', line 32
def to_c_dir_bin
s = pack_for_c_dir
(self.class.const_get(:HEADER_ID) + [s.bytesize].pack('v')) << s
end
|
#to_local_bin ⇒ Object
27
28
29
30
|
# File 'lib/zip/extra_field/generic.rb', line 27
def to_local_bin
s = pack_for_local
(self.class.const_get(:HEADER_ID) + [s.bytesize].pack('v')) << s
end
|