Class: Synthra::Types::TextContent::Avatar

Inherits:
Base
  • Object
show all
Defined in:
lib/synthra/types/text_content/misc.rb

Overview

Avatar type

Instance Method Summary collapse

Instance Method Details

#generate_edge(rng, context, args) ⇒ Object



14
15
16
# File 'lib/synthra/types/text_content/misc.rb', line 14

def generate_edge(rng, context, args)
  ["", "https://i.pravatar.cc/1?img=1"].sample(random: rng.instance_variable_get(:@random))
end

#generate_invalid(rng, context, args) ⇒ Object



18
19
20
# File 'lib/synthra/types/text_content/misc.rb', line 18

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

#generate_random(rng, context, args) ⇒ Object



8
9
10
11
12
# File 'lib/synthra/types/text_content/misc.rb', line 8

def generate_random(rng, context, args)
  height = args[:height] || 200
  width = args[:width] || 200
  "https://i.pravatar.cc/#{width}?img=#{rng.int(1, 70)}"
end