Class: Synthra::Types::TechnologyInternet::Base64ImageUrl

Inherits:
Base
  • Object
show all
Defined in:
lib/synthra/types/technology_internet/formats.rb

Overview

Base64ImageUrl type

Instance Method Summary collapse

Instance Method Details

#generate_edge(rng, context, args) ⇒ Object



89
90
91
# File 'lib/synthra/types/technology_internet/formats.rb', line 89

def generate_edge(rng, context, args)
  ["", "data:image/png;base64,invalid"].sample(random: rng.instance_variable_get(:@random))
end

#generate_invalid(rng, context, args) ⇒ Object



93
94
95
# File 'lib/synthra/types/technology_internet/formats.rb', line 93

def generate_invalid(rng, context, args)
  [nil, 123, [], {}].sample(random: rng.instance_variable_get(:@random))
end

#generate_random(rng, context, args) ⇒ Object



84
85
86
87
# File 'lib/synthra/types/technology_internet/formats.rb', line 84

def generate_random(rng, context, args)
  # Generate a data URL with base64 encoded image
  "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNk+M9QDwADhgGAWjR9awAAAABJRU5ErkJggg=="
end