Class: Mspack::ChmDecompressor::Header

Inherits:
Object
  • Object
show all
Defined in:
lib/mspack/chm_decompressor.rb,
ext/mspack_native/chm_decompressor_header.c

Instance Method Summary collapse

Instance Method Details

#each_fileObject

Convenience method for iterating over files. Takes a block and yields files.



20
21
22
23
24
25
26
27
# File 'lib/mspack/chm_decompressor.rb', line 20

def each_file
  file = files

  while !file.nil?
    yield file
    file = file.next
  end
end

#each_file_with_indexObject

Convenience method for iterating over files. Takes a block and yields files and an index number.



31
32
33
34
35
36
37
38
# File 'lib/mspack/chm_decompressor.rb', line 31

def each_file_with_index
  index = 0

  each_file do |file|
    yield file, index
    index += 1
  end
end

#fast_open?Boolean

Returns:

  • (Boolean)


25
26
27
# File 'ext/mspack_native/chm_decompressor_header.c', line 25

VALUE chmd_header_is_fast_open(VALUE self) {
  return rb_iv_get(self, "is_fast_open");
}

#filenameObject



6
7
8
9
10
# File 'ext/mspack_native/chm_decompressor_header.c', line 6

VALUE chmd_header_filename(VALUE self) {
  struct mschmd_header *header;
  Data_Get_Struct(self, struct mschmd_header, header);
  return rb_str_new2(header->filename);
}

#filesObject



12
13
14
15
16
17
18
19
20
21
22
23
# File 'ext/mspack_native/chm_decompressor_header.c', line 12

VALUE chmd_header_files(VALUE self) {
  struct mschmd_header *header;
  Data_Get_Struct(self, struct mschmd_header, header);

  if (!header->files) {
    return Qnil;
  }
  
  VALUE file = Data_Wrap_Struct(ChmDFile, NULL, NULL, header->files);
  rb_iv_set(file, "is_fast_find", Qfalse);
  return file;
}