Class: NWN::Gff::Writer
- Inherits:
-
Object
- Object
- NWN::Gff::Writer
- Includes:
- NWN::Gff
- Defined in:
- lib/nwn/gff/writer.rb
Constant Summary
Constants included from NWN::Gff
ComplexTypes, FileFormatGuesses, Formats, InputFormats, OutputFormats, SimpleTypes, Types
Instance Attribute Summary collapse
-
#bytes ⇒ Object
readonly
Returns the value of attribute bytes.
Class Method Summary collapse
-
.dump(gff, io = nil, data_type = nil) ⇒ Object
Takes a NWN::Gff::Gff object and dumps it to
io, including the header.
Instance Method Summary collapse
-
#initialize(gff, data_type = nil) ⇒ Writer
constructor
:nodoc:.
Methods included from NWN::Gff
guess_file_format, read, write
Constructor Details
#initialize(gff, data_type = nil) ⇒ Writer
:nodoc:
22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/nwn/gff/writer.rb', line 22 def initialize(gff, data_type = nil) #:nodoc: @gff = gff @data_type = data_type @structs = [] @fields = [] @labels = [] @field_indices = [] @list_indices = [] @field_data = "" write_all end |
Instance Attribute Details
#bytes ⇒ Object (readonly)
Returns the value of attribute bytes.
6 7 8 |
# File 'lib/nwn/gff/writer.rb', line 6 def bytes @bytes end |
Class Method Details
.dump(gff, io = nil, data_type = nil) ⇒ Object
Takes a NWN::Gff::Gff object and dumps it to io, including the header. If io is nil, return the raw bytes, otherwise the number of bytes written.
12 13 14 15 16 17 18 19 20 |
# File 'lib/nwn/gff/writer.rb', line 12 def self.dump(gff, io = nil, data_type = nil) ret = new(gff, data_type).bytes if io io.write(ret) ret.size else ret end end |