class Faker::StarWars

Public Class Methods

call_number() click to toggle source
# File lib/faker/star_wars.rb, line 12
def call_number
  sample(call_numbers)
end
call_numbers() click to toggle source
# File lib/faker/star_wars.rb, line 44
def call_numbers
  fetch_all('star_wars.call_numbers')
end
call_sign() click to toggle source
# File lib/faker/star_wars.rb, line 8
def call_sign
  numerify(parse('star_wars.call_sign'))
end
call_squadron() click to toggle source
# File lib/faker/star_wars.rb, line 4
def call_squadron
  sample(call_squadrons)
end
call_squadrons() click to toggle source
# File lib/faker/star_wars.rb, line 48
def call_squadrons
  fetch_all('star_wars.call_squadrons')
end
character() click to toggle source
# File lib/faker/star_wars.rb, line 16
def character
  sample(characters)
end
characters() click to toggle source
# File lib/faker/star_wars.rb, line 52
def characters
  fetch_all('star_wars.characters')
end
droid() click to toggle source
# File lib/faker/star_wars.rb, line 20
def droid
  sample(droids)
end
droids() click to toggle source
# File lib/faker/star_wars.rb, line 56
def droids
  fetch_all('star_wars.droids')
end
planet() click to toggle source
# File lib/faker/star_wars.rb, line 24
def planet
  sample(planets)
end
planets() click to toggle source
# File lib/faker/star_wars.rb, line 60
def planets
  fetch_all('star_wars.planets')
end
quote(character = nil) click to toggle source
# File lib/faker/star_wars.rb, line 64
def quote(character = nil)
  quoted_characters = translate('faker.star_wars.quotes')

  if character.nil?
    character = sample(quoted_characters.keys).to_s
  else
    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

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

  fetch('star_wars.quotes.' + character)
end
specie() click to toggle source
# File lib/faker/star_wars.rb, line 28
def specie
  sample(species)
end
species() click to toggle source
# File lib/faker/star_wars.rb, line 85
def species
  fetch_all('star_wars.species')
end
vehicle() click to toggle source
# File lib/faker/star_wars.rb, line 32
def vehicle
  sample(vehicles)
end
vehicles() click to toggle source
# File lib/faker/star_wars.rb, line 89
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
# File lib/faker/star_wars.rb, line 36
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
# File lib/faker/star_wars.rb, line 93
def wookiee_words
  fetch_all('star_wars.wookiee_words')
end
Also aliased as: wookie_words