Sha256: bfff28061649252842eeca02f0ce7f673fa66aa5aa75459e84b9ee84115024bd

Contents?: true

Size: 534 Bytes

Versions: 4

Compression:

Stored size: 534 Bytes

Contents

module HolderRails
  module Helpers
    def holder_tag(size, text='', theme=nil, html_options={}, holder_options={})
      size = "#{size}x#{size}" unless size =~ /\A\d+p?x\d+\z/

      holder_options[:text] = text unless text.to_s.empty?
      holder_options[:theme] = theme unless theme.nil?
      holder_options = holder_options.map {|e| e.join('=') }.join('&')

      options = { src: '', data: { src: "holder.js/#{size}?#{holder_options}" }}
      options = options.merge(html_options)

      tag :img, options
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
holder_rails-2.9.3.1 lib/holder_rails/helpers.rb
holder_rails-2.9.3 lib/holder_rails/helpers.rb
holder_rails-2.9.2 lib/holder_rails/helpers.rb
holder_rails-2.9.1 lib/holder_rails/helpers.rb