Class: Imgry::Processor::Adapter

Inherits:
Object
  • Object
show all
Defined in:
lib/imgry/processor.rb

Direct Known Subclasses

JavaAdapter, MiniMagick

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(img_blob) ⇒ Adapter

Returns a new instance of Adapter.



18
19
20
21
22
23
# File 'lib/imgry/processor.rb', line 18

def initialize(img_blob)
  @img_blob = img_blob
  @format = nil
  @img = nil
  load_image!
end

Instance Attribute Details

#formatObject

Returns the value of attribute format.



16
17
18
# File 'lib/imgry/processor.rb', line 16

def format
  @format
end

#imgObject

Returns the value of attribute img.



16
17
18
# File 'lib/imgry/processor.rb', line 16

def img
  @img
end

#img_blobObject

Returns the value of attribute img_blob.



16
17
18
# File 'lib/imgry/processor.rb', line 16

def img_blob
  @img_blob
end

Class Method Details

.from_file(path) ⇒ Object



12
13
14
# File 'lib/imgry/processor.rb', line 12

def self.from_file(path)
  # Abstract
end

.load_lib!Object



5
6
# File 'lib/imgry/processor.rb', line 5

def self.load_lib!
end

.with_bytes(img_bytes) ⇒ Object



8
9
10
# File 'lib/imgry/processor.rb', line 8

def self.with_bytes(img_bytes)
  # Abstract
end

Instance Method Details

#aspect_ratioObject



37
38
39
# File 'lib/imgry/processor.rb', line 37

def aspect_ratio
  width.to_f / height.to_f
end

#inspectObject



25
26
27
28
29
30
31
# File 'lib/imgry/processor.rb', line 25

def inspect
  if @format
    "#<#{self.class} format: #{@format}>"
  else
    "#<#{self.class}>"
  end
end

#load_image!Object



33
34
35
# File 'lib/imgry/processor.rb', line 33

def load_image!
  # Abstract
end