Class: Faker::Fillmurray

Inherits:
Base
  • Object
show all
Defined in:
lib/faker/fillmurray.rb

Constant Summary

Constants inherited from Base

Base::Letters, Base::Numbers, Base::ULetters

Class Method Summary collapse

Methods inherited from Base

bothify, fetch, fetch_all, flexible, letterify, method_missing, numerify, parse, rand, rand_in_range, regexify, respond_to_missing?, sample, shuffle, translate, unique, with_locale

Class Method Details

.image(grayscale = false, width = 200, height = 200) ⇒ Object

Raises:

  • (ArgumentError)


4
5
6
7
8
9
10
# 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