Module: HolderRails::Helpers

Defined in:
lib/holder_rails/helpers.rb

Instance Method Summary collapse

Instance Method Details

#holder_tag(size, text = '', theme = nil, html_options = {}) ⇒ Object



3
4
5
6
7
8
9
10
# File 'lib/holder_rails/helpers.rb', line 3

def holder_tag(size, text='', theme=nil, html_options={})
  size = "#{size}x#{size}" unless size =~ /\A\d+%?x\d+\z/
  text = text.to_s.empty? ? size : text
  options = {:src => '', :data => {:src => "holder.js/#{size}/text:#{text}/#{theme}"}}
  options = options.merge(html_options)

  tag :img, options
end