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(lang: :ruby) ⇒ String
Produces source code for Hello World in a given language.
-
.print(str: 'some string', lang: :ruby) ⇒ String
Produces source code for printing a string in a given language.
-
.print_1_to_10(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, 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
.hello_world(lang: :ruby) ⇒ String
Produces source code for Hello World in a given language.
20 21 22 |
# File 'lib/faker/default/source.rb', line 20 def hello_world(lang: :ruby) fetch("source.hello_world.#{lang}") end |
.print(str: 'some string', lang: :ruby) ⇒ String
Produces source code for printing a string in a given language.
38 39 40 41 |
# File 'lib/faker/default/source.rb', line 38 def print(str: 'some string', lang: :ruby) code = fetch("source.print.#{lang}") code.gsub('faker_string_to_print', str) end |
.print_1_to_10(lang: :ruby) ⇒ String
Produces source code for printing 1 through 10 in a given language.
58 59 60 |
# File 'lib/faker/default/source.rb', line 58 def print_1_to_10(lang: :ruby) fetch("source.print_1_to_10.#{lang}") end |