Class: Synthra::Types::PersonalNames::FirstNameEuropean

Inherits:
Base
  • Object
show all
Defined in:
lib/synthra/types/personal_names/names.rb

Overview

FirstNameEuropean type

Constant Summary collapse

EUROPEAN_FIRST_NAMES =
[
  "Maria", "Sophie", "Anna", "Elena", "Laura",
  "Luca", "Marco", "David", "Thomas", "Paul"
].freeze

Instance Method Summary collapse

Instance Method Details

#generate_edge(rng, context, args) ⇒ Object



236
237
238
# File 'lib/synthra/types/personal_names/names.rb', line 236

def generate_edge(rng, context, args)
  ["", "A", "Very Long European FirstName"].sample(random: rng.instance_variable_get(:@random))
end

#generate_invalid(rng, context, args) ⇒ Object



240
241
242
# File 'lib/synthra/types/personal_names/names.rb', line 240

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

#generate_random(rng, context, args) ⇒ Object



222
223
224
225
226
227
228
229
230
231
232
233
# File 'lib/synthra/types/personal_names/names.rb', line 222

def generate_random(rng, context, args)
  adapter = faker_adapter(context)
  if adapter && adapter.respond_to?(:european_first_name)
    adapter.european_first_name

  else
    rng.sample(EUROPEAN_FIRST_NAMES)
  end

rescue StandardError
  rng.sample(EUROPEAN_FIRST_NAMES)
end