Class: Identify::Image
- Inherits:
-
Object
show all
- Defined in:
- lib/identify.rb
Defined Under Namespace
Classes: BMP, GIF, JFIF, PBM, PCX, PNG, TIFF, XBM, XPM
Class Method Summary
collapse
Instance Method Summary
collapse
Class Method Details
9
10
11
|
# File 'lib/identify.rb', line 9
def self.formats
@formats ||= []
end
|
.identify(data) ⇒ Object
17
18
19
20
|
# File 'lib/identify.rb', line 17
def self.identify data
format = formats.find {|klass| klass.handle? data}
format ? format.parse(data) : {}
end
|
.inherited(klass) ⇒ Object
13
14
15
|
# File 'lib/identify.rb', line 13
def self.inherited klass
formats << klass
end
|
.parse(data) ⇒ Object
22
23
24
|
# File 'lib/identify.rb', line 22
def self.parse data
new.parse data
end
|
Instance Method Details
#as_hash(format, width, height) ⇒ Object
26
27
28
|
# File 'lib/identify.rb', line 26
def as_hash format, width, height
{width: width.to_i, height: height.to_i, format: format}
end
|