Class: Gastly::Image
- Inherits:
-
Object
- Object
- Gastly::Image
- Defined in:
- lib/gastly/image.rb
Instance Attribute Summary collapse
-
#image ⇒ Object
readonly
Returns the value of attribute image.
Instance Method Summary collapse
- #crop(width:, height:, x:, y:) ⇒ Object
-
#format(ext) ⇒ MiniMagick::Image
Instance.
-
#initialize(image) ⇒ Image
constructor
A new instance of Image.
- #resize(width:, height:) ⇒ Object
-
#save(output) ⇒ String
Full path to image.
Constructor Details
#initialize(image) ⇒ Image
Returns a new instance of Image.
6 7 8 |
# File 'lib/gastly/image.rb', line 6 def initialize(image) @image = image end |
Instance Attribute Details
#image ⇒ Object (readonly)
Returns the value of attribute image.
3 4 5 |
# File 'lib/gastly/image.rb', line 3 def image @image end |
Instance Method Details
#crop(width:, height:, x:, y:) ⇒ Object
21 22 23 24 |
# File 'lib/gastly/image.rb', line 21 def crop(width:, height:, x:, y:) dimensions = "#{width}x#{height}+#{x}+#{y}" image.crop(dimensions) end |
#format(ext) ⇒ MiniMagick::Image
Returns Instance.
28 29 30 |
# File 'lib/gastly/image.rb', line 28 def format(ext) image.format(ext) end |
#resize(width:, height:) ⇒ Object
12 13 14 15 |
# File 'lib/gastly/image.rb', line 12 def resize(width:, height:) dimensions = "#{width}x#{height}" image.resize(dimensions) end |
#save(output) ⇒ String
Returns Full path to image.
34 35 36 37 |
# File 'lib/gastly/image.rb', line 34 def save(output) image.write(output) output end |