Module: PaperCropper::ModelExtension::InstanceMethods
- Defined in:
- lib/paper_cropper/model_extension.rb
Overview
Instance methods #########################################################################
Instance Method Summary collapse
- #attachment_changed?(attachment_name) ⇒ Boolean
-
#cropping?(attachment_name) ⇒ Boolean
Asks if the attachment received a crop process.
-
#method_missing(method, *args) ⇒ Object
Uses method missing to responding the model callback for reprocess the image.
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *args) ⇒ Object
Uses method missing to responding the model callback for reprocess the image
98 99 100 101 102 103 104 105 106 |
# File 'lib/paper_cropper/model_extension.rb', line 98 def method_missing(method, *args) if method.to_s =~ PaperCropper::RegExp::CALLBACK ( method.to_s.scan(PaperCropper::RegExp::CALLBACK).flatten.first.to_sym ) else super end end |
Instance Method Details
#attachment_changed?(attachment_name) ⇒ Boolean
83 84 85 86 87 88 89 90 91 92 93 94 95 |
# File 'lib/paper_cropper/model_extension.rb', line 83 def () ["#{}_name", "#{}_content_type", "#{}_file_size", "#{}_updated_at", "#{}_crop_x", "#{}_crop_y", "#{}_crop_width", "#{}_crop_height", "#{}_crop_ratio" ].any? { |attr| method= "#{attr}_changed?".to_sym if respond_to?(method) self.send(method) end } end |
#cropping?(attachment_name) ⇒ Boolean
Asks if the attachment received a crop process
76 77 78 79 80 81 |
# File 'lib/paper_cropper/model_extension.rb', line 76 def cropping?() !self.send(:"#{}_crop_x").blank? && !self.send(:"#{}_crop_y").blank? && !self.send(:"#{}_crop_width").blank? && !self.send(:"#{}_crop_height").blank? end |