Module: ASE::Reader::InstanceMethods

Defined in:
lib/ase/reader.rb

Instance Method Summary collapse

Instance Method Details

#from_file(file) ⇒ Object



18
19
20
21
# File 'lib/ase/reader.rb', line 18

def from_file(file)
  @file = file
  read!
end

#read!Object



23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/ase/reader.rb', line 23

def read!
  raise "Must specify an output file" if @file.nil?
  @file = File.new(@file, 'rb')

  # Signature and version, who cares?
  # Okay maybe we should validate this in the future.
  @file.seek 8, IO::SEEK_CUR

  block_count = @file.read_ulong
  
  read_palette until @file.eof?

  @file.close
end