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 37 38 39 40 |
# 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 @palette = Palette.new(:default) read_section until @file.eof? add_palette @palette if @palettes.length == 0 @palette = nil @file.close end |