Class: Faker::Travel::TrainStation

Inherits:
Base
  • Object
show all
Defined in:
lib/faker/travel/train_station.rb

Constant Summary

Constants inherited from Base

Base::LLetters, Base::Letters, Base::NOT_GIVEN, Base::Numbers, Base::ULetters

Class Method Summary collapse

Methods inherited from Base

bothify, disable_enforce_available_locales, fetch, fetch_all, flexible, generate, letterify, method_missing, numerify, parse, rand, rand_in_range, regexify, resolve, respond_to_missing?, sample, shuffle, translate, unique, with_locale

Class Method Details

.name(region: nil, type: nil) ⇒ String

Produces random Train Station by name and takes optional arguments for region and type

Faker::Travel::TrainStation.name(region: ‘united_kingdom’, type: ‘metro’) => “Brockley” Faker::Travel::TrainStation.name(type: ‘railway’) => “Düsseldorf Hauptbahnhof” Faker::Travel::TrainStation.name(region: ‘spain’) => “Santa Eulàlia”

Parameters:

  • region (String) (defaults to: nil)

    Train station region: germany, spain, united_kingdom, united_states

  • type (String) (defaults to: nil)

    Train station type: metro, railway

Returns:

  • (String)

Available since:

  • next



22
23
24
25
# File 'lib/faker/travel/train_station.rb', line 22

def name(region: nil, type: nil)
  region, type = fill_missing_inputs_with_samples(region, type)
  fetch("train_station.#{region}.#{type}")
end