Class: Faker::Movies::StarWars
- Defined in:
- lib/faker/movies/star_wars.rb
Constant Summary
Constants inherited from Base
Base::LLetters, Base::Letters, Base::NOT_GIVEN, Base::Numbers, Base::ULetters
Class Method Summary collapse
-
.call_number ⇒ String
Produces a call number from Star Wars.
-
.call_numbers ⇒ Array
Generates numbers array.
-
.call_sign ⇒ String
Produces a call sign from Star Wars.
-
.call_squadron ⇒ String
Produces a call squadron from Star Wars.
-
.call_squadrons ⇒ Array
Returns squadrons array.
-
.character ⇒ String
Produces a character from Star Wars.
-
.characters ⇒ Array
Returns all character names in movie.
-
.droid ⇒ String
Produces a droid from Star Wars.
-
.droids ⇒ Array
Returns droid list.
-
.planet ⇒ String
Produces a planet from Star Wars.
-
.planets ⇒ Array
Lists out all planet names.
-
.quote(character: nil) ⇒ String
Produces a quote from Star Wars.
-
.specie ⇒ String
Produces a species from Star Wars.
-
.species ⇒ Array
Returns name of all species.
-
.vehicle ⇒ String
Produces a vehicle from Star Wars.
-
.vehicles ⇒ Array
Lists out all vehicles.
-
.wookiee_sentence ⇒ String
(also: wookie_sentence)
Produces a wookiee sentence from Star Wars.
-
.wookiee_words ⇒ Array
(also: wookie_words)
All wookiee words.
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
.call_number ⇒ String
Produces a call number from Star Wars.
42 43 44 |
# File 'lib/faker/movies/star_wars.rb', line 42 def call_number sample(call_numbers) end |
.call_numbers ⇒ Array
Generates numbers array
169 170 171 |
# File 'lib/faker/movies/star_wars.rb', line 169 def call_numbers fetch_all('star_wars.call_numbers') end |
.call_sign ⇒ String
Produces a call sign from Star Wars.
29 30 31 |
# File 'lib/faker/movies/star_wars.rb', line 29 def call_sign numerify(parse('star_wars.call_sign')) end |
.call_squadron ⇒ String
Produces a call squadron from Star Wars.
16 17 18 |
# File 'lib/faker/movies/star_wars.rb', line 16 def call_squadron sample(call_squadrons) end |
.call_squadrons ⇒ Array
Returns squadrons array
182 183 184 |
# File 'lib/faker/movies/star_wars.rb', line 182 def call_squadrons fetch_all('star_wars.call_squadrons') end |
.character ⇒ String
Produces a character from Star Wars.
55 56 57 |
# File 'lib/faker/movies/star_wars.rb', line 55 def character sample(characters) end |
.characters ⇒ Array
Returns all character names in movie
195 196 197 |
# File 'lib/faker/movies/star_wars.rb', line 195 def characters fetch_all('star_wars.characters') end |
.droid ⇒ String
Produces a droid from Star Wars.
68 69 70 |
# File 'lib/faker/movies/star_wars.rb', line 68 def droid sample(droids) end |
.droids ⇒ Array
Returns droid list
208 209 210 |
# File 'lib/faker/movies/star_wars.rb', line 208 def droids fetch_all('star_wars.droids') end |
.planet ⇒ String
Produces a planet from Star Wars.
81 82 83 |
# File 'lib/faker/movies/star_wars.rb', line 81 def planet sample(planets) end |
.planets ⇒ Array
Lists out all planet names
221 222 223 |
# File 'lib/faker/movies/star_wars.rb', line 221 def planets fetch_all('star_wars.planets') end |
.quote(character: nil) ⇒ String
Produces a quote from Star Wars.
141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 |
# 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 ⇒ String
Produces a species from Star Wars.
94 95 96 |
# File 'lib/faker/movies/star_wars.rb', line 94 def specie sample(species) end |
.species ⇒ Array
Returns name of all species
234 235 236 |
# File 'lib/faker/movies/star_wars.rb', line 234 def species fetch_all('star_wars.species') end |
.vehicle ⇒ String
Produces a vehicle from Star Wars.
107 108 109 |
# File 'lib/faker/movies/star_wars.rb', line 107 def vehicle sample(vehicles) end |
.vehicles ⇒ Array
Lists out all vehicles
247 248 249 |
# File 'lib/faker/movies/star_wars.rb', line 247 def vehicles fetch_all('star_wars.vehicles') end |
.wookiee_sentence ⇒ String Also known as: wookie_sentence
Produces a wookiee sentence from Star Wars.
119 120 121 122 123 124 125 |
# 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 |
.wookiee_words ⇒ Array Also known as: wookie_words
All wookiee words
260 261 262 |
# File 'lib/faker/movies/star_wars.rb', line 260 def wookiee_words fetch_all('star_wars.wookiee_words') end |