Module: LoremImageWare::Helpers
- Defined in:
- lib/lorem-image-ware.rb
Instance Method Summary collapse
- #lorem_image_path(options = {}) ⇒ Object
- #lorem_image_root ⇒ Object
- #lorem_image_tag(options = {}) ⇒ Object
Instance Method Details
#lorem_image_path(options = {}) ⇒ Object
24 25 26 27 28 29 30 |
# File 'lib/lorem-image-ware.rb', line 24 def lorem_image_path( = {}) height = .fetch(:height, 200) width = .fetch(:width, 400) tag = .fetch(:tag, "abstract") "#{lorem_image_root}/image/#{width}/#{height}/#{tag}?r=#{rand(99)}" end |
#lorem_image_root ⇒ Object
20 21 22 |
# File 'lib/lorem-image-ware.rb', line 20 def lorem_image_root "/lorem" end |
#lorem_image_tag(options = {}) ⇒ Object
32 33 34 35 36 37 38 |
# File 'lib/lorem-image-ware.rb', line 32 def lorem_image_tag( = {}) height = .fetch(:height, 200) width = .fetch(:width, 400) html_class = [[:class], "lorem-image"].compact.join(" ") %Q{<img src="#{lorem_image_path()}" class="#{html_class}" width="#{width}" height="#{height}" style="height: #{height}px; width: #{width}px;" />} end |