Class: VitalsImage::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/vitals_image/base.rb

Constant Summary collapse

TINY_GIF =
"data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"

Class Method Summary collapse

Class Method Details

.analyzer(object) ⇒ Object

Raises:



14
15
16
17
18
19
# File 'lib/vitals_image/base.rb', line 14

def self.analyzer(object)
  klass = VitalsImage.analyzers.detect { |analyzer| analyzer.accept?(object) }
  raise UnanalyzableError, "Object is not supported: #{object.class}" unless klass

  klass.new(object)
end

.optimizer(object, options = {}) ⇒ Object

Raises:



7
8
9
10
11
12
# File 'lib/vitals_image/base.rb', line 7

def self.optimizer(object, options = {})
  klass = VitalsImage.optimizers.detect { |optimizer| optimizer.accept?(object) }
  raise UnoptimizableError, "Object is not supported: #{object.class}" unless klass

  klass.new(object, options)
end