Class: Gravaty::Parsers::Pixelsize

Inherits:
Object
  • Object
show all
Includes:
Utils::Raisers
Defined in:
lib/gravaty/parsers/pixelsize.rb

Overview

This class is an implementation of the Parsable duck type that checks the image size. The only needed parameter is a valid image size.

Author

Marco Bresciani

rubocop:disable Style/AsciiComments

Copyright

Copyright © 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020 Marco Bresciani

rubocop:enable Style/AsciiComments

License

GNU General Public License version 3

Instance Method Summary collapse

Methods included from Utils::Raisers

#raiser_downcase, #raiser_to_i

Instance Method Details

#parse(value = nil) ⇒ Object

The parsable duck type interface to every parser usage.



47
48
49
50
# File 'lib/gravaty/parsers/pixelsize.rb', line 47

def parse(value = nil)
  raiser_to_i('error.value', value, ALLOWED_SIZES)
  value.nil? ? '' : "s=#{value}"
end