class Faker::Movies::StarWars

Public Class Methods

call_number() click to toggle source

Produces a call number from Star Wars.

@return [String]

@example

Faker::Movies::StarWars.call_number #=> "Leader"

@faker.version 1.6.2

# File lib/faker/movies/star_wars.rb, line 42
def call_number
  sample(call_numbers)
end
call_numbers() click to toggle source

Generates numbers array

@return [Array]

@example

Faker::Movies::StarWars.call_numbers  #=> ["Leader", "#"]

@faker.version 1.6.2

# File lib/faker/movies/star_wars.rb, line 169
def call_numbers
  fetch_all('star_wars.call_numbers')
end
call_sign() click to toggle source

Produces a call sign from Star Wars.

@return [String]

@example

Faker::Movies::StarWars.call_sign #=> "Grey 5"

@faker.version 1.6.2

# File lib/faker/movies/star_wars.rb, line 29
def call_sign
  numerify(parse('star_wars.call_sign'))
end
call_squadron() click to toggle source

Produces a call squadron from Star Wars.

@return [String]

@example

Faker::Movies::StarWars.call_squadron #=> "Green"

@faker.version 1.6.2

# File lib/faker/movies/star_wars.rb, line 16
def call_squadron
  sample(call_squadrons)
end
call_squadrons() click to toggle source

Returns squadrons array

@return [Array]

@example

Faker::Movies::StarWars.call_squadrons  #=> ["Rogue", "Red", "Gray", "Green", "Blue", "Gold", "Black", "Yellow", "Phoenix"]

@faker.version 1.6.2

# File lib/faker/movies/star_wars.rb, line 182
def call_squadrons
  fetch_all('star_wars.call_squadrons')
end
character() click to toggle source

Produces a character from Star Wars.

@return [String]

@example

Faker::Movies::StarWars.character #=> "Anakin Skywalker"

@faker.version 1.6.2

# File lib/faker/movies/star_wars.rb, line 55
def character
  sample(characters)
end
characters() click to toggle source

Returns all character names in movie

@return [Array]

@example

Faker::Movies::StarWars.characters

@faker.version 1.6.2

# File lib/faker/movies/star_wars.rb, line 195
def characters
  fetch_all('star_wars.characters')
end
droid() click to toggle source

Produces a droid from Star Wars.

@return [String]

@example

Faker::Movies::StarWars.droid #=> "C-3PO"

@faker.version 1.6.2

# File lib/faker/movies/star_wars.rb, line 68
def droid
  sample(droids)
end
droids() click to toggle source

Returns droid list

@return [Array]

@example

Faker::Movies::StarWars.droids

@faker.version 1.6.2

# File lib/faker/movies/star_wars.rb, line 208
def droids
  fetch_all('star_wars.droids')
end
planet() click to toggle source

Produces a planet from Star Wars.

@return [String]

@example

Faker::Movies::StarWars.planet #=> "Tatooine"

@faker.version 1.6.2

# File lib/faker/movies/star_wars.rb, line 81
def planet
  sample(planets)
end
planets() click to toggle source

Lists out all planet names

@return [Array]

@example

Faker::Movies::StarWars.planets

@faker.version 1.6.2

# File lib/faker/movies/star_wars.rb, line 221
def planets
  fetch_all('star_wars.planets')
end
quote(character: nil) click to toggle source

Produces a quote from Star Wars.

@param character [String] The name of a character to derive a quote from. @return [String]

@example

Faker::Movies::StarWars.quote #=> "Aren't you a little short for a Stormtrooper?"

@example

Faker::Movies::StarWars.quote(character: "leia_organa")
  #=> "Aren't you a little short for a Stormtrooper?"

@faker.version 1.6.2

# File lib/faker/movies/star_wars.rb, line 141
def quote(character: nil)
  quoted_characters = translate('faker.star_wars.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.star_wars.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("star_wars.quotes.#{character}")
end
specie() click to toggle source

Produces a species from Star Wars.

@return [String]

@example

Faker::Movies::StarWars.specie #=> "Gungan"

@faker.version 1.6.2

# File lib/faker/movies/star_wars.rb, line 94
def specie
  sample(species)
end
species() click to toggle source

Returns name of all species

@return [Array]

@example

Faker::Movies::StarWars.species

@faker.version 1.6.2

# File lib/faker/movies/star_wars.rb, line 234
def species
  fetch_all('star_wars.species')
end
vehicle() click to toggle source

Produces a vehicle from Star Wars.

@return [String]

@example

Faker::Movies::StarWars.vehicle #=> "Sandcrawler"

@faker.version 1.6.2

# File lib/faker/movies/star_wars.rb, line 107
def vehicle
  sample(vehicles)
end
vehicles() click to toggle source

Lists out all vehicles

@return [Array]

@example

Faker::Movies::StarWars.vehicles

@faker.version 1.6.2

# File lib/faker/movies/star_wars.rb, line 247
def vehicles
  fetch_all('star_wars.vehicles')
end
wookie_sentence()
Alias for: wookiee_sentence
wookie_words()
Alias for: wookiee_words
wookiee_sentence() click to toggle source

Produces a wookiee sentence from Star Wars.

@return [String]

@example

Faker::Movies::StarWars.wookiee_sentence #=> "Yrroonn ru ooma roo ahuma ur roooarrgh hnn-rowr."

@faker.version 1.6.2

# File lib/faker/movies/star_wars.rb, line 119
def wookiee_sentence
  sentence = sample(wookiee_words).capitalize

  rand(0..10).times { sentence += " #{sample(wookiee_words)}" }

  sentence + sample(['.', '?', '!'])
end
Also aliased as: wookie_sentence
wookiee_words() click to toggle source

All wookiee words

@return [Array]

@example

Faker::Movies::StarWars.wookiee_words

@faker.version 1.6.2

# File lib/faker/movies/star_wars.rb, line 260
def wookiee_words
  fetch_all('star_wars.wookiee_words')
end
Also aliased as: wookie_words