class Faker::Fillmurray

Public Class Methods

image(grayscale = false, width = 200, height = 200) click to toggle source
# File lib/faker/fillmurray.rb, line 4
def image(grayscale = false, width = 200, height = 200)
  raise ArgumentError, 'Width should be a number' unless width.to_s =~ /^\d+$/
  raise ArgumentError, 'Height should be a number' unless height.to_s =~ /^\d+$/
  raise ArgumentError, 'Grayscale should be a boolean' unless [true, false].include?(grayscale)

  grayscale == true ? "https://fillmurray.com/g/#{width}/#{height}" : "https://fillmurray.com/#{width}/#{height}"
end