Class: Faker::Fillmurray

Inherits:
Base
  • Object
show all
Extended by:
Gem::Deprecate
Defined in:
lib/faker/default/fillmurray.rb

Constant Summary

Constants inherited from Base

Base::LLetters, Base::Letters, Base::NOT_GIVEN, Base::Numbers, Base::ULetters

Class Method Summary collapse

Methods inherited from Base

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

Class Method Details

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

Raises:

  • (ArgumentError)


28
29
30
31
32
33
34
# File 'lib/faker/default/fillmurray.rb', line 28

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)

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