Class: NWN::Gff::Reader

Inherits:
Object
  • Object
show all
Includes:
NWN::Gff
Defined in:
lib/nwn/gff/reader.rb

Overview

A class that parses binary GFF bytes into ruby-friendly data structures.

Constant Summary

Constants included from NWN::Gff

ComplexTypes, FileFormatGuesses, Formats, InputFormats, OutputFormats, SimpleTypes, Types

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from NWN::Gff

guess_file_format, write

Constructor Details

#initialize(io) ⇒ Reader

:nodoc:



15
16
17
18
19
# File 'lib/nwn/gff/reader.rb', line 15

def initialize io #:nodoc:
  @io = io
  io.internal_encoding == nil or raise "passed io needs to be binary, is #{io.internal_encoding.inspect}"
  read_all
end

Instance Attribute Details

#root_structObject (readonly)

Returns the value of attribute root_struct.



5
6
7
# File 'lib/nwn/gff/reader.rb', line 5

def root_struct
  @root_struct
end

Class Method Details

.read(io) ⇒ Object

Create a new Reader with the given io and immediately parse it.



10
11
12
13
# File 'lib/nwn/gff/reader.rb', line 10

def self.read io
  t = new(io)
  t.root_struct
end