Module: FFaker::Avatar

Extended by:
Avatar, ModuleUtils
Included in:
Avatar
Defined in:
lib/ffaker/avatar.rb

Constant Summary collapse

SUPPORTED_FORMATS =
%w[png jpg bmp].freeze

Instance Method Summary collapse

Methods included from ModuleUtils

const_missing, k, underscore, unique

Methods included from RandomUtils

#fetch_sample, #rand, #shuffle

Instance Method Details

#image(slug = nil, size = '300x300', format = 'png', bgset = nil) ⇒ Object


10
11
12
13
14
# File 'lib/ffaker/avatar.rb', line 10

def image(slug = nil, size = '300x300', format = 'png', bgset = nil)
  check_passed_params(size, format, bgset)
  slug ||= FFaker::Lorem.words.join
  "https://robohash.org/#{slug}.#{format}?size=#{size}#{'&bgset=bg' + bgset.to_s if bgset}"
end