Class: Faker::Movies::Tron

Inherits:
Base
  • Object
show all
Defined in:
lib/faker/movies/tron.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, shuffle!, translate, unique, with_locale

Class Method Details

.characterString

Produces a character from Tron.

Examples:

Faker::Movies::Tron.character #=> "Bit"

Returns:



16
17
18
# File 'lib/faker/movies/tron.rb', line 16

def character
  sample(characters)
end

.charactersObject



131
132
133
# File 'lib/faker/movies/tron.rb', line 131

def characters
  translate('faker.tron.characters').values.flatten
end

.gameString

Produces a game from Tron.

Examples:

Faker::Movies::Tron.game #=> "Space Paranoids"

Returns:



29
30
31
# File 'lib/faker/movies/tron.rb', line 29

def game
  sample(games)
end

.gamesObject



135
136
137
# File 'lib/faker/movies/tron.rb', line 135

def games
  fetch_all('tron.games')
end

.locationString

Produces a location from Tron.

Examples:

Faker::Movies::Tron.location #=> "Flynn's Arcade"

Returns:



42
43
44
# File 'lib/faker/movies/tron.rb', line 42

def location
  sample(locations)
end

.locationsObject



139
140
141
# File 'lib/faker/movies/tron.rb', line 139

def locations
  fetch_all('tron.locations')
end

.programString

Produces a program from Tron.

Examples:

Faker::Movies::Tron.program #=> "Clu"

Returns:



55
56
57
# File 'lib/faker/movies/tron.rb', line 55

def program
  sample(programs)
end

.programsObject



143
144
145
# File 'lib/faker/movies/tron.rb', line 143

def programs
  fetch_all('tron.characters.programs')
end

.quote(character: nil) ⇒ String

Produces a quote from Tron.

Examples:

Faker::Movies::Tron.quote #=> "Greetings, Programs!"
Faker::Movies::Tron.quote(character: "mcp")
  #=> "End of Line."

Parameters:

  • character (String) (defaults to: nil)

    The name of a character to derive a quote from.

Returns:



73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
# File 'lib/faker/movies/tron.rb', line 73

def quote(character: nil)
  quoted_characters = translate('faker.tron.quotes')

  if character.nil?
    character = sample(quoted_characters.keys).to_s
  else
    character = character.to_s.downcase

    # check alternate spellings, nicknames, titles of characters
    translate('faker.tron.alternate_character_spellings').each do |k, v|
      character = k.to_s if v.include?(character)
    end

    raise ArgumentError, "Character for quotes can be left blank or #{quoted_characters.keys.join(', ')}" unless quoted_characters.key?(character.to_sym)
  end

  fetch("tron.quotes.#{character}")
end

.taglineString

Produces a tagline from Tron.

Examples:

Faker::Movies::Tron.tagline #=> "The Electronic Gladiator"

Returns:



101
102
103
# File 'lib/faker/movies/tron.rb', line 101

def tagline
  sample(taglines)
end

.taglinesObject



147
148
149
# File 'lib/faker/movies/tron.rb', line 147

def taglines
  fetch_all('tron.taglines')
end

.userString

Produces a user from Tron.

Examples:

Faker::Movies::Tron.user #=> "Light Cycle"

Returns:



114
115
116
# File 'lib/faker/movies/tron.rb', line 114

def user
  sample(users)
end

.usersObject



151
152
153
# File 'lib/faker/movies/tron.rb', line 151

def users
  fetch_all('tron.characters.users')
end

.vehicleString

Produces a vehicle from Tron.

Examples:

Faker::Movies::Tron.vehicle #=> "Light Cycle"

Returns:



127
128
129
# File 'lib/faker/movies/tron.rb', line 127

def vehicle
  sample(vehicles)
end

.vehiclesObject



155
156
157
# File 'lib/faker/movies/tron.rb', line 155

def vehicles
  fetch_all('tron.vehicles')
end