Class: Imagga::CropInfo

Inherits:
ImageInfoBase show all
Defined in:
lib/imagga/image.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(opts = {}) ⇒ CropInfo

Returns a new instance of CropInfo.



100
101
102
103
104
105
# File 'lib/imagga/image.rb', line 100

def initialize(opts={})
  super({'url' => opts['url']})
  self.class.crop_fields.each do |field|
    send("#{field}=", build_image_crops(opts[field]))
  end
end

Class Method Details

.crop_fieldsObject



96
97
98
# File 'lib/imagga/image.rb', line 96

def self.crop_fields
  %w(croppings)
end

.fieldsObject



92
93
94
# File 'lib/imagga/image.rb', line 92

def self.fields
  %w(url)
end

Instance Method Details

#build_image_crops(image_crop_nodes) ⇒ Object



107
108
109
# File 'lib/imagga/image.rb', line 107

def build_image_crops(image_crop_nodes)
  image_crop_nodes && image_crop_nodes.map { |crop_node| ImageCrop.new(crop_node) }
end