Class: Swiff

Inherits:
Object
  • Object
show all
Includes:
Compression, HeaderInfo
Defined in:
lib/swiff.rb,
lib/swiff/compression.rb,
lib/swiff/header_info.rb,
lib/swiff/packed_bits.rb

Defined Under Namespace

Modules: Compression, HeaderInfo Classes: PackedBits

Constant Summary

Constants included from HeaderInfo

HeaderInfo::COMPRESSED, HeaderInfo::UNCOMPRESSED

Instance Attribute Summary

Attributes included from HeaderInfo

#compression_type, #frame_count, #frame_rate, #height, #nbits, #signature, #size, #version, #width, #x_max, #y_max

Instance Method Summary collapse

Methods included from Compression

#compress, #decompress, #is_compressed?, #read_file, #read_full_size, #strip_header

Methods included from HeaderInfo

#convert_pixels_to_twips, #convert_twips_to_pixels, #inspect, #is_swf?, #parse_header, #read_packed_bits, #to_s

Constructor Details

#initialize(path) ⇒ Swiff

Returns a new instance of Swiff.



10
11
12
13
# File 'lib/swiff.rb', line 10

def initialize(path)
  @path = path
  parse_header
end

Instance Method Details

#bytesObject



15
16
17
# File 'lib/swiff.rb', line 15

def bytes
  @file_contents ||= File.read(@path)
end

#decompressed_bytesObject



19
20
21
22
23
24
25
# File 'lib/swiff.rb', line 19

def decompressed_bytes
  if is_compressed?
    @decompressed_file_contents ||= self.decompress
  else 
    @decompressed_file_contents = @file_contents
  end
end