Sha256: 87b68e4c074538c3a6ab3eb70d252458c2881d33cd2f581b992fdba084bebccb

Contents?: true

Size: 425 Bytes

Versions: 16

Compression:

Stored size: 425 Bytes

Contents

module Paperclip
  class Attachment
    extend ActiveSupport::Memoizable

    def to_liquid
      {}.tap do |h|
        all_styles = self.styles.keys + ['original']
        all_styles.each do |style|
          g = Paperclip::Geometry.from_file(self.path(style))
          h[style] = {'width' => g.width.to_i, 'height' => g.height.to_i, 'url' => self.url(style)}
        end
      end
    end
    memoize :to_liquid
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
liquid_cms-0.2.0.9 app/liquid/cms_paperclip_extension.rb
liquid_cms-0.3.0.7 app/liquid/cms_paperclip_extension.rb
liquid_cms-0.3.0.6 app/liquid/cms_paperclip_extension.rb
liquid_cms-0.2.0.8 app/liquid/cms_paperclip_extension.rb
liquid_cms-0.3.0.5 app/liquid/cms_paperclip_extension.rb
liquid_cms-0.2.0.7 app/liquid/cms_paperclip_extension.rb
liquid_cms-0.3.0.4 app/liquid/cms_paperclip_extension.rb
liquid_cms-0.2.0.6 app/liquid/cms_paperclip_extension.rb
liquid_cms-0.3.0.3 app/liquid/cms_paperclip_extension.rb
liquid_cms-0.2.0.5 app/liquid/cms_paperclip_extension.rb
liquid_cms-0.3.0.2 app/liquid/cms_paperclip_extension.rb
liquid_cms-0.2.0.3 app/liquid/cms_paperclip_extension.rb
liquid_cms-0.2.0.2 app/liquid/cms_paperclip_extension.rb
liquid_cms-0.3.0.1 app/liquid/cms_paperclip_extension.rb
liquid_cms-0.3.0 app/liquid/cms_paperclip_extension.rb
liquid_cms-0.2.0 app/liquid/cms_paperclip_extension.rb