Sha256: e6b562c8f31821717e6215b4f0a2472254aea41b2c1da385c33618d60f226ce6

Contents?: true

Size: 552 Bytes

Versions: 1

Compression:

Stored size: 552 Bytes

Contents

module BuddiesAvatar
  module ORM
    module ActiveRecord
      extend ActiveSupport::Concern
      include Base
    
      included do
        attr_accessor :crop_x, :crop_y, :crop_w, :crop_h
      end
    
      def cropping?
        !crop_x.blank? && !crop_y.blank? && !crop_w.blank? && !crop_h.blank?
      end
    
      def crop_string
        "#{crop_w}x#{crop_h}+#{crop_x}+#{crop_y}"
      end
    
      def clean_crop_fields
        [:crop_x, :crop_y, :crop_w, :crop_h].each { |field| update_attribute field, nil }
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
buddies_avatar-0.0.1 lib/buddies_avatar/orm/active_record.rb