Class: LoremImageWare::LoremPixelProvider

Inherits:
Object
  • Object
show all
Defined in:
lib/lorem-image-ware.rb

Instance Method Summary collapse

Constructor Details

#initialize(grayscale = false) ⇒ LoremPixelProvider

Returns a new instance of LoremPixelProvider.



7
8
9
# File 'lib/lorem-image-ware.rb', line 7

def initialize(grayscale = false)
  @grayscale = grayscale
end

Instance Method Details

#url(params) ⇒ Object



11
12
13
14
15
16
17
18
19
20
# File 'lib/lorem-image-ware.rb', line 11

def url(params)
  type = params[:type] || "abstract"

  [
    "http://lorempixel.com",
    @grayscale ? "g" : nil,
    params[:width], params[:height], type,
    "?r=#{rand(20)}"
  ].compact.join("/")
end