Class: Faker::Source
Constant Summary
Constants inherited from Base
Base::LLetters, Base::Letters, Base::NOT_GIVEN, Base::Numbers, Base::ULetters
Class Method Summary collapse
-
.hello_world(legacy_lang = NOT_GIVEN, lang: :ruby) ⇒ String
Produces source code for Hello World in a given language.
-
.print(legacy_str = NOT_GIVEN, legacy_lang = NOT_GIVEN, str: 'some string', lang: :ruby) ⇒ String
Produces source code for printing a string in a given language.
-
.print_1_to_10(legacy_lang = NOT_GIVEN, lang: :ruby) ⇒ String
Produces source code for printing 1 through 10 in a given language.
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
.hello_world(legacy_lang = NOT_GIVEN, lang: :ruby) ⇒ String
Produces source code for Hello World in a given language.
20 21 22 23 24 25 26 |
# File 'lib/faker/default/source.rb', line 20 def hello_world(legacy_lang = NOT_GIVEN, lang: :ruby) warn_for_deprecated_arguments do |keywords| keywords << :lang if legacy_lang != NOT_GIVEN end fetch("source.hello_world.#{lang}") end |
.print(legacy_str = NOT_GIVEN, legacy_lang = NOT_GIVEN, str: 'some string', lang: :ruby) ⇒ String
Produces source code for printing a string in a given language.
42 43 44 45 46 47 48 49 50 51 |
# File 'lib/faker/default/source.rb', line 42 def print(legacy_str = NOT_GIVEN, legacy_lang = NOT_GIVEN, str: 'some string', lang: :ruby) warn_for_deprecated_arguments do |keywords| keywords << :str if legacy_str != NOT_GIVEN end warn_for_deprecated_arguments do |keywords| keywords << :lang if legacy_lang != NOT_GIVEN end code = fetch("source.print.#{lang}") code.gsub('faker_string_to_print', str) end |
.print_1_to_10(legacy_lang = NOT_GIVEN, lang: :ruby) ⇒ String
Produces source code for printing 1 through 10 in a given language.
68 69 70 71 72 73 |
# File 'lib/faker/default/source.rb', line 68 def print_1_to_10(legacy_lang = NOT_GIVEN, lang: :ruby) warn_for_deprecated_arguments do |keywords| keywords << :lang if legacy_lang != NOT_GIVEN end fetch("source.print_1_to_10.#{lang}") end |