Class: Mspack::ChmDecompressor::Header

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

Instance Method Summary collapse

Instance Method Details

#each_fileObject

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



7
8
9
10
11
12
13
14
# File 'lib/mspack/chm_decompressor.rb', line 7

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.



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

def each_file_with_index
  index = 0

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

#filenameObject



61
62
63
64
65
# File 'ext/mspack_native/mspack_native.c', line 61

static 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



67
68
69
70
71
72
73
74
# File 'ext/mspack_native/mspack_native.c', line 67

static VALUE chmd_header_files(VALUE self) {
  struct mschmd_header *header;
  Data_Get_Struct(self, struct mschmd_header, header);
  
  VALUE fileObj = rb_obj_alloc(ChmDFile);
  rb_obj_call_init(fileObj, 0, NULL);
  return Data_Wrap_Struct(ChmDFile, NULL, NULL, header->files);
}