Skip to content

Commit 916d8f8

Browse files
authored
1 parent ca96418 commit 916d8f8

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

lib/faker/default/avatar.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ class << self
3737
#
3838
# @faker.version 1.4.3
3939
def image(slug: nil, size: '300x300', format: 'png', set: 'set1', bgset: nil)
40-
raise ArgumentError, 'Size should be specified in format 300x300' unless size =~ /^[0-9]+x[0-9]+$/
40+
raise ArgumentError, 'Size should be specified in format 300x300' unless size =~ /\A[0-9]+x[0-9]+\z/
4141
raise ArgumentError, "Supported formats are #{SUPPORTED_FORMATS.join(', ')}" unless SUPPORTED_FORMATS.include?(format)
4242

4343
slug ||= Faker::Lorem.words.join

lib/faker/default/lorem_flickr.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ def colorized_image(size: '300x300', color: 'red', search_terms: ['all'], match_
9696
private
9797

9898
def build_url(size, format, search_terms, match_all)
99-
raise ArgumentError, 'Size should be specified in format 300x300' unless size =~ /^[0-9]+x[0-9]+$/
99+
raise ArgumentError, 'Size should be specified in format 300x300' unless size =~ /\A[0-9]+x[0-9]+\z/
100100

101101
url_parts = ['https://loremflickr.com']
102102
url_parts << format

lib/faker/default/placeholdit.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ def image(size: '300x300', format: 'png', background_color: nil, text_color: nil
3030
background_color = generate_color if background_color == :random
3131
text_color = generate_color if text_color == :random
3232

33-
raise ArgumentError, 'Size should be specified in format 300x300' unless size =~ /^[0-9]+x[0-9]+$/
33+
raise ArgumentError, 'Size should be specified in format 300x300' unless size =~ /\A[0-9]+x[0-9]+\z$/
3434
raise ArgumentError, "Supported formats are #{SUPPORTED_FORMATS.join(', ')}" unless SUPPORTED_FORMATS.include?(format)
3535
raise ArgumentError, "background_color must be a hex value without '#'" unless background_color.nil? || background_color =~ /((?:^\h{3}$)|(?:^\h{6}$)){1}(?!.*\H)/
3636
raise ArgumentError, "text_color must be a hex value without '#'" unless text_color.nil? || text_color =~ /((?:^\h{3}$)|(?:^\h{6}$)){1}(?!.*\H)/

0 commit comments

Comments
 (0)