Class: DotDiff::Image::Container
- Inherits:
-
Object
- Object
- DotDiff::Image::Container
- Defined in:
- lib/dotdiff/image/container.rb
Instance Method Summary collapse
- #both_images_same_dimensions? ⇒ Boolean
- #dimensions_mismatch_msg ⇒ Object
-
#initialize(baseimg_file, newimg_file) ⇒ Container
constructor
A new instance of Container.
- #total_pixels ⇒ Object
Constructor Details
#initialize(baseimg_file, newimg_file) ⇒ Container
Returns a new instance of Container.
6 7 8 9 |
# File 'lib/dotdiff/image/container.rb', line 6 def initialize(baseimg_file, newimg_file) @baseimg_file = baseimg_file @newimg_file = newimg_file end |
Instance Method Details
#both_images_same_dimensions? ⇒ Boolean
11 12 13 14 |
# File 'lib/dotdiff/image/container.rb', line 11 def both_images_same_dimensions? base_image.width == new_image.width && base_image.height == new_image.height end |
#dimensions_mismatch_msg ⇒ Object
20 21 22 23 24 25 26 |
# File 'lib/dotdiff/image/container.rb', line 20 def dimensions_mismatch_msg " Images are not the same dimensions to be compared\n Base file: \#{base_image.width}x\#{base_image.height}\n New file: \#{new_image.width}x\#{new_image.height}\n MSG\nend\n" |
#total_pixels ⇒ Object
16 17 18 |
# File 'lib/dotdiff/image/container.rb', line 16 def total_pixels base_image.width * base_image.height end |