Class: Faker::LoremFlickr

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

Constant Summary collapse

SUPPORTED_COLORIZATIONS =
%w[red green blue].freeze

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

.colorized_image(size = '300x300', color = 'red', search_terms = ['all'], match_all = false) ⇒ Object

Raises:

  • (ArgumentError)


22
23
24
25
26
27
# File 'lib/faker/lorem_flickr.rb', line 22

def colorized_image(size = '300x300', color = 'red', search_terms = ['all'], match_all = false)
  raise ArgumentError, 'Search terms must be specified for colorized images' unless search_terms.any?
  raise ArgumentError, "Supported colorizations are #{SUPPORTED_COLORIZATIONS.join(', ')}" unless SUPPORTED_COLORIZATIONS.include?(color)

  build_url(size, color, search_terms, match_all)
end

.grayscale_image(size = '300x300', search_terms = ['all'], match_all = false) ⇒ Object

Raises:

  • (ArgumentError)


10
11
12
13
14
# File 'lib/faker/lorem_flickr.rb', line 10

def grayscale_image(size = '300x300', search_terms = ['all'], match_all = false)
  raise ArgumentError, 'Search terms must be specified for grayscale images' unless search_terms.any?

  build_url(size, 'g', search_terms, match_all)
end

.image(size = '300x300', search_terms = [], match_all = false) ⇒ Object



6
7
8
# File 'lib/faker/lorem_flickr.rb', line 6

def image(size = '300x300', search_terms = [], match_all = false)
  build_url(size, nil, search_terms, match_all)
end

.pixelated_image(size = '300x300', search_terms = ['all'], match_all = false) ⇒ Object

Raises:

  • (ArgumentError)


16
17
18
19
20
# File 'lib/faker/lorem_flickr.rb', line 16

def pixelated_image(size = '300x300', search_terms = ['all'], match_all = false)
  raise ArgumentError, 'Search terms must be specified for pixelated images' unless search_terms.any?

  build_url(size, 'p', search_terms, match_all)
end