Method: Cloudinary::Utils.build_eager

Defined in:
lib/cloudinary/utils.rb

.build_eager(eager) ⇒ Object

Parameters:

  • eager (String|Hash|Array)

    an transformation as a string or hash, with or without a format. The parameter also accepts an array of eager transformations.



1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
# File 'lib/cloudinary/utils.rb', line 1114

def self.build_eager(eager)
  return nil if eager.nil?
  Cloudinary::Utils.build_array(eager).map do
  |transformation, format|
    unless transformation.is_a? String
      transformation = transformation.clone
      if transformation.respond_to?(:delete)
        format = transformation.delete(:format) || format
      end
      transformation = Cloudinary::Utils.generate_transformation_string(transformation, true)
    end
    [transformation, format].compact.join("/")
  end.join("|")
end