Class: Flickrage::Service::Resizer

Inherits:
Object
  • Object
show all
Includes:
Helpers::Log
Defined in:
lib/flickrage/service/resizer.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Helpers::Log

#logger, #speaker

Constructor Details

#initialize(width, height) ⇒ Resizer



9
10
11
12
# File 'lib/flickrage/service/resizer.rb', line 9

def initialize(width, height)
  @width  = width
  @height = height
end

Instance Attribute Details

#heightObject (readonly)

Returns the value of attribute height.



7
8
9
# File 'lib/flickrage/service/resizer.rb', line 7

def height
  @height
end

#widthObject (readonly)

Returns the value of attribute width.



7
8
9
# File 'lib/flickrage/service/resizer.rb', line 7

def width
  @width
end

Instance Method Details

#run(image) ⇒ Object



14
15
16
17
18
19
20
21
# File 'lib/flickrage/service/resizer.rb', line 14

def run(image)
  return image unless image.downloaded?
  resize_to_fill(image)
  check_image(image)
rescue => e
  logger.debug(e)
  image
end