Class: Identify::Image::XPM

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

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

Returns:

  • (Boolean)


31
32
33
# File 'lib/identify.rb', line 31

def self.handle? data
  %r{\A#{Regexp.escape('/* XPM */')}}.match(data)
end

Instance Method Details

#parse(data) ⇒ Object



35
36
37
# File 'lib/identify.rb', line 35

def parse data
  as_hash 'xpm', *data.scan(%r{"(\d+)\s+(\d+)(?=[\s\d]+")}).flatten
end