Class: AirVideo::AvMap::BinaryData

Inherits:
Object
  • Object
show all
Defined in:
lib/airvideo.rb

Overview

A simple container for Binary Data. With AirVideo this is used to hold thumbnail JPG data.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data) ⇒ BinaryData

Not really useful outside of the AvMap module



378
379
380
# File 'lib/airvideo.rb', line 378

def initialize(data) # :nodoc:
  @data = data
end

Instance Attribute Details

#dataObject (readonly)

Returns the value of attribute data.



375
376
377
# File 'lib/airvideo.rb', line 375

def data
  @data
end

Instance Method Details

#inspectObject



395
396
397
# File 'lib/airvideo.rb', line 395

def inspect
  "<Data: #{@data.length} bytes>"
end

#lengthObject



391
392
393
# File 'lib/airvideo.rb', line 391

def length
  @data.length
end

#write_to(filename) ⇒ Object

Writes the data to the given filename

TODO: LibMagic to detect what the extension should be?



385
386
387
388
389
# File 'lib/airvideo.rb', line 385

def write_to(filename)
  open(filename,"w") do |f|
    f.write @data
  end
end