Class: AppInfo::PngUncrush

Inherits:
Object show all
Defined in:
lib/app_info/png_uncrush.rb

Defined Under Namespace

Classes: Error, FormatError, PngReader

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(filename) ⇒ PngUncrush

Returns a new instance of PngUncrush.

Raises:



69
70
71
72
# File 'lib/app_info/png_uncrush.rb', line 69

def initialize(filename)
  @io = PngReader.new(File.open(filename))
  raise FormatError, 'not a png file' unless @io.png?
end

Class Method Details

.decompress(input, output) ⇒ Object



61
62
63
# File 'lib/app_info/png_uncrush.rb', line 61

def self.decompress(input, output)
  new(input).decompress(output)
end

.dimensions(input) ⇒ Object



65
66
67
# File 'lib/app_info/png_uncrush.rb', line 65

def self.dimensions(input)
  new(input).dimensions
end

Instance Method Details

#decompress(output) ⇒ Object



78
79
80
81
82
83
# File 'lib/app_info/png_uncrush.rb', line 78

def decompress(output)
  content = _remap(_dump_sections)
  return false unless content

  write_file(output, content)
end

#dimensionsObject



74
75
76
# File 'lib/app_info/png_uncrush.rb', line 74

def dimensions
  _dump_sections(dimensions: true)
end