Class: IFF::FORM
Instance Attribute Summary collapse
-
#tag ⇒ Object
readonly
Returns the value of attribute tag.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Class Method Summary collapse
Instance Method Summary collapse
- #chunks ⇒ Object
- #chunks=(chunks) ⇒ Object
-
#initialize(tag, chunks) ⇒ FORM
constructor
A new instance of FORM.
- #serialize(stream, options) ⇒ Object
Methods inherited from Base
Constructor Details
#initialize(tag, chunks) ⇒ FORM
Returns a new instance of FORM.
206 207 208 209 |
# File 'lib/iff.rb', line 206 def initialize( tag, chunks ) @tag = tag @chunks = chunks.to_a.dup end |
Instance Attribute Details
#tag ⇒ Object (readonly)
Returns the value of attribute tag.
189 190 191 |
# File 'lib/iff.rb', line 189 def tag @tag end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
190 191 192 |
# File 'lib/iff.rb', line 190 def type @type end |
Class Method Details
.unserialize(tag, length, stream, options) ⇒ Object
192 193 194 195 196 197 198 199 200 201 202 203 204 |
# File 'lib/iff.rb', line 192 def self.unserialize( tag, length, stream, ) raise EOFError, "Premature end of content" if length < 4 type = stream.read( 4 ) raise EOFError, "Premature end of content" if type.length < 4 parser = Parser.new( stream, length, ) chunks = [] loop do chunk = parser.parse break unless chunk chunks << chunk end self.new( tag, chunks ) end |
Instance Method Details
#chunks ⇒ Object
211 |
# File 'lib/iff.rb', line 211 def chunks ; @chunks.dup ; end |
#chunks=(chunks) ⇒ Object
212 |
# File 'lib/iff.rb', line 212 def chunks=( chunks ) ; @chunks = chunks.to_a.dup ; end |