Sha256: 98f8c3dc03662ed03f0bfddceadd0cb306845b9da1ca4917d27341aa98aea2c8
Contents?: true
Size: 1.06 KB
Versions: 2
Compression:
Stored size: 1.06 KB
Contents
require 'active_support/core_ext' module Crimagify module DinamicImageMethods extend ActiveSupport::Concern def build_methods_images(methods = nil) array_methods = [] CRIMAGIFY_ENV["#{self.name}"].each do |item| array_methods << item.first end array_methods.each do |name| define_method("#{name}") do img = crimagify_images.find_by_image_name("#{name}")# rescue "" if img == nil return [] else return img end end end end def build_sizes_images#(methods = nil) array_versions = [] CRIMAGIFY_ENV.each do |image_name| image_name[1].each do |name| name_version = name[1] name_version.each do |item| array_versions << item.first end end end array_versions = array_versions.uniq array_versions.each do |name_size| size_image = name_size.to_sym define_method("#{name_size}") do image = image_url(size_image) rescue "" if image == "" image = "rails.png" end return image end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
crimagify-0.0.2.1 | lib/crimagify/dinamic_image_methods.rb |
crimagify-0.0.2 | lib/crimagify/dinamic_image_methods.rb |