Class: ImageOptim::ImageMeta

Inherits:
Object
  • Object
show all
Defined in:
lib/image_optim/image_meta.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(format) ⇒ ImageMeta

Returns a new instance of ImageMeta.



20
21
22
# File 'lib/image_optim/image_meta.rb', line 20

def initialize(format)
  @format = format
end

Instance Attribute Details

#formatObject (readonly)

Returns the value of attribute format.



19
20
21
# File 'lib/image_optim/image_meta.rb', line 19

def format
  @format
end

Class Method Details

.for_data(data) ⇒ Object



12
13
14
15
16
17
# File 'lib/image_optim/image_meta.rb', line 12

def self.for_data(data)
  is = ImageSize.new(data)
  new(is.format)
rescue => e
  warn "#{e} (detecting format of image data)"
end

.for_path(path) ⇒ Object



5
6
7
8
9
10
# File 'lib/image_optim/image_meta.rb', line 5

def self.for_path(path)
  is = ImageSize.path(path)
  new(is.format)
rescue => e
  warn "#{e} (detecting format of image at #{path})"
end