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 ⇒ Object
-
.call_sign ⇒ String
Produces a call sign from Star Wars.
-
.call_squadron ⇒ String
Produces a call squadron from Star Wars.
- .call_squadrons ⇒ Object
-
.character ⇒ String
Produces a character from Star Wars.
- .characters ⇒ Object
-
.droid ⇒ String
Produces a droid from Star Wars.
- .droids ⇒ Object
-
.planet ⇒ String
Produces a planet from Star Wars.
- .planets ⇒ Object
-
.quote(legacy_character = NOT_GIVEN, character: nil) ⇒ String
Produces a quote from Star Wars.
-
.specie ⇒ String
Produces a species from Star Wars.
- .species ⇒ Object
-
.vehicle ⇒ String
Produces a vehicle from Star Wars.
- .vehicles ⇒ Object
-
.wookiee_sentence ⇒ String
(also: wookie_sentence)
Produces a wookiee sentence from Star Wars.
- .wookiee_words ⇒ Object (also: wookie_words)
Methods inherited from Base
bothify, disable_enforce_available_locales, fetch, fetch_all, flexible, letterify, method_missing, numerify, parse, rand, rand_in_range, regexify, resolve, respond_to_missing?, sample, 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 ⇒ Object
164 165 166 |
# File 'lib/faker/movies/star_wars.rb', line 164 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 ⇒ Object
168 169 170 |
# File 'lib/faker/movies/star_wars.rb', line 168 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 ⇒ Object
172 173 174 |
# File 'lib/faker/movies/star_wars.rb', line 172 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 ⇒ Object
176 177 178 |
# File 'lib/faker/movies/star_wars.rb', line 176 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 ⇒ Object
180 181 182 |
# File 'lib/faker/movies/star_wars.rb', line 180 def planets fetch_all('star_wars.planets') end |
.quote(legacy_character = NOT_GIVEN, 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 159 160 161 162 |
# File 'lib/faker/movies/star_wars.rb', line 141 def quote(legacy_character = NOT_GIVEN, character: nil) warn_for_deprecated_arguments do |keywords| keywords << :character if legacy_character != NOT_GIVEN end 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 ⇒ Object
184 185 186 |
# File 'lib/faker/movies/star_wars.rb', line 184 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 ⇒ Object
188 189 190 |
# File 'lib/faker/movies/star_wars.rb', line 188 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 ⇒ Object Also known as: wookie_words
192 193 194 |
# File 'lib/faker/movies/star_wars.rb', line 192 def wookiee_words fetch_all('star_wars.wookiee_words') end |