Class: Versionable::Version
- Inherits:
-
Object
- Object
- Versionable::Version
- Defined in:
- lib/versionable/version.rb
Defined Under Namespace
Classes: Crop
Constant Summary collapse
- FIT_IN =
'fit-in'.freeze
- SMART =
'smart'.freeze
- UNSAFE =
'unsafe'.freeze
- META =
'meta'.freeze
- HALIGNEMENTS =
%w(left center right).freeze
- VALIGNEMENTS =
%w(top middle bottom).freeze
Instance Attribute Summary collapse
-
#height ⇒ Object
readonly
Returns the value of attribute height.
-
#width ⇒ Object
readonly
Returns the value of attribute width.
Instance Method Summary collapse
- #calculate_metadata ⇒ Object
-
#initialize(image, parameters, &blk) ⇒ Version
constructor
A new instance of Version.
- #url ⇒ Object
Constructor Details
#initialize(image, parameters, &blk) ⇒ Version
15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/versionable/version.rb', line 15 def initialize(image, parameters, &blk) @image = image @height = parameters.fetch(:height) { 0 } @width = parameters.fetch(:width) { 0 } @fit_in = parameters.fetch(:fit_in) { false } @smart = parameters.fetch(:smart) { false } = parameters.fetch(:meta) { false } @filters = [] instance_eval(&blk) if block_given? end |
Instance Attribute Details
#height ⇒ Object (readonly)
Returns the value of attribute height.
14 15 16 |
# File 'lib/versionable/version.rb', line 14 def height @height end |
#width ⇒ Object (readonly)
Returns the value of attribute width.
14 15 16 |
# File 'lib/versionable/version.rb', line 14 def width @width end |
Instance Method Details
#calculate_metadata ⇒ Object
35 36 37 38 39 40 |
# File 'lib/versionable/version.rb', line 35 def { width: calculate_width, height: calculate_height } end |
#url ⇒ Object
27 28 29 30 31 32 33 |
# File 'lib/versionable/version.rb', line 27 def url [ server, sign, ].reject(&:nil?).join('/') end |