Sha256: 0cdd5e03632d59b0affc580e0df2024ba86112bc7ab0ed7c0ac8f42aa59c6206
Contents?: true
Size: 1.01 KB
Versions: 50
Compression:
Stored size: 1.01 KB
Contents
module Kuhsaft class ImageSize attr_accessor :name, :width, :height def label I18n.t("activerecord.attributes.kuhsaft/image_size.sizes.#{name}") end class << self def all @all ||= [] end def build_defaults! @all = [gallery_size, teaser_size] end def find_by_name(name) all.find { |size| size.name.to_s == name.to_s } end def clear! @all = [] end def add(name, width, height) @all << ImageSize.new.tap do |size| size.name = name.to_sym size.width = width size.height = height end end def gallery_size @gallery_size ||= ImageSize.new.tap do |size| size.name = :gallery size.width = 960 size.height = 540 end end def teaser_size @teaser_size ||= ImageSize.new.tap do |size| size.name = :teaser size.width = 320 size.height = 180 end end end end end
Version data entries
50 entries across 50 versions & 1 rubygems