Sha256: 60ff32e99ff4c4167fd666377a11fdef8ef7e2805bf6dcbdd285f56082f97ad0
Contents?: true
Size: 631 Bytes
Versions: 1
Compression:
Stored size: 631 Bytes
Contents
module Faker class Avatar < Base class << self SUPPORTED_FORMATS = %w[png jpg bmp].freeze def image(slug = nil, size = '300x300', format = 'png', set = 'set1', bgset = nil) raise ArgumentError, 'Size should be specified in format 300x300' unless size =~ /^[0-9]+x[0-9]+$/ raise ArgumentError, "Supported formats are #{SUPPORTED_FORMATS.join(', ')}" unless SUPPORTED_FORMATS.include?(format) slug ||= Faker::Lorem.words.join bgset_query = "&bgset=#{bgset}" if bgset "https://robohash.org/#{slug}.#{format}?size=#{size}&set=#{set}#{bgset_query}" end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
faker-1.9.1 | lib/faker/avatar.rb |