Class: Synthra::Types::TechnologyInternet::DummyImageUrl
- Defined in:
- lib/synthra/types/technology_internet/formats.rb
Overview
DummyImageUrl type
Instance Method Summary collapse
- #generate_edge(rng, context, args) ⇒ Object
- #generate_invalid(rng, context, args) ⇒ Object
- #generate_random(rng, context, args) ⇒ Object
Instance Method Details
#generate_edge(rng, context, args) ⇒ Object
112 113 114 |
# File 'lib/synthra/types/technology_internet/formats.rb', line 112 def generate_edge(rng, context, args) ["", "https://dummyimage.com/1x1/000/fff.jpg"].sample(random: rng.instance_variable_get(:@random)) end |
#generate_invalid(rng, context, args) ⇒ Object
116 117 118 |
# File 'lib/synthra/types/technology_internet/formats.rb', line 116 def generate_invalid(rng, context, args) [nil, 123, [], {}].sample(random: rng.instance_variable_get(:@random)) end |
#generate_random(rng, context, args) ⇒ Object
100 101 102 103 104 105 106 107 108 109 110 |
# File 'lib/synthra/types/technology_internet/formats.rb', line 100 def generate_random(rng, context, args) min_height = args[:minHeight] || 100 max_height = args[:maxHeight] || 800 min_width = args[:minWidth] || 100 max_width = args[:maxWidth] || 1200 format = args[:format] || "jpg" height = rng.int(min_height, max_height) width = rng.int(min_width, max_width) "https://dummyimage.com/#{width}x#{height}/000/fff.#{format}" end |