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.



67
68
69
70
71
72
73
74
# File 'lib/mspack/chm_decompressor.rb', line 67

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.



78
79
80
81
82
83
84
85
# File 'lib/mspack/chm_decompressor.rb', line 78

def each_file_with_index
  index = 0

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

#fast_open?Boolean

Returns:

  • (Boolean)


28
29
30
# File 'ext/mspack_native/chm_decompressor_header.c', line 28

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

#filenameObject



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

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



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

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

  if (!header->files) {
    return Qnil;
  }

  struct chmd_file_wrapper *wrapper = malloc(sizeof(struct chmd_file_wrapper));
  wrapper->is_fast_find = 0;
  wrapper->file = header->files;
  
  return Data_Wrap_Struct(ChmDFile, NULL, chmd_file_free, wrapper);
}