Class: Identify::Image::XBM

Inherits:
Identify::Image show all
Defined in:
lib/identify.rb

Overview

PBM

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Identify::Image

#as_hash, formats, identify, inherited, parse

Class Method Details

.handle?(data) ⇒ Boolean



117
118
119
# File 'lib/identify.rb', line 117

def self.handle? data
  %r{\A#define\s+.*width}i.match(data)
end

Instance Method Details

#parse(data) ⇒ Object



121
122
123
# File 'lib/identify.rb', line 121

def parse data
  as_hash 'xbm', *data.scan(%r{^#define\s+.*?_(?:width|height)\s+(\d+)}).flatten
end