### Get Programming Language Creator Source: https://github.com/faker-ruby/faker/blob/main/doc/default/programming_language.md Use this to generate the creator of a programming language. No setup is required. ```ruby Faker::ProgrammingLanguage.creator #=> "Yukihiro Matsumoto" ``` -------------------------------- ### Install Dependencies with Bundler Source: https://github.com/faker-ruby/faker/blob/main/CONTRIBUTING.md Run this command after forking and cloning the repository to install all necessary Ruby gems. ```ruby bundle install ``` -------------------------------- ### YARD Documentation Example Source: https://github.com/faker-ruby/faker/blob/main/CONTRIBUTING.md Include YARD style documentation for new generators, detailing description, parameters, return type, example output, and version. ```ruby ## # Produces a random string of alphabetic characters, (no digits) # # @param char_count [Integer] The length of the string to generate # # @return [String] # # @example # Faker::Alphanumeric.alpha #=> "kgdpxlgwjirlqhwhrebvuomdcjjpeqlq" # Faker::Alphanumeric.alpha(number: 10) #=> "zlvubkrwga" # # @faker.version next def alpha(number: 32) # ... end ``` -------------------------------- ### Generate Hitchhiker's Guide to the Galaxy Data Source: https://github.com/faker-ruby/faker/blob/main/doc/default/hitchhikers_guide_to_the_galaxy.md Use these methods to generate random data inspired by The Hitchhiker's Guide to the Galaxy. No specific setup or imports are required beyond including the Faker gem. ```ruby Faker::HitchhikersGuideToTheGalaxy.character #=> "Marvin" ``` ```ruby Faker::HitchhikersGuideToTheGalaxy.location #=> "Arthur Dent's house" ``` ```ruby Faker::HitchhikersGuideToTheGalaxy.marvin_quote #=> "Life? Don't talk to me about life." ``` ```ruby Faker::HitchhikersGuideToTheGalaxy.planet #=> "Magrathea" ``` ```ruby Faker::HitchhikersGuideToTheGalaxy.quote #=> "In the beginning, the Universe was created. This has made a lot of people very angry and been widely regarded as a bad move." ``` ```ruby Faker::HitchhikersGuideToTheGalaxy.specie #=> "Perfectly Normal Beast" ``` ```ruby Faker::HitchhikersGuideToTheGalaxy.starship #=> "Vogon Constructor Fleet" ``` -------------------------------- ### Add Faker to Gemfile Source: https://github.com/faker-ruby/faker/blob/main/README.md Include the Faker gem in your Gemfile to start using it in your project. Run `bundle install` afterwards. ```ruby gem 'faker' ``` -------------------------------- ### Generate Hitchhiker's Guide to the Galaxy Data Source: https://github.com/faker-ruby/faker/blob/main/doc/movies/hitchhikers_guide_to_the_galaxy.md Use this module to generate random data points from The Hitchhiker's Guide to the Galaxy. No specific setup or imports are required beyond the Faker gem. ```ruby Faker::Movies::HitchhikersGuideToTheGalaxy.character #=> "Marvin" ``` ```ruby Faker::Movies::HitchhikersGuideToTheGalaxy.location #=> "Arthur Dent's house" ``` ```ruby Faker::Movies::HitchhikersGuideToTheGalaxy.marvin_quote #=> "Life? Don't talk to me about life." ``` ```ruby Faker::Movies::HitchhikersGuideToTheGalaxy.planet #=> "Magrathea" ``` ```ruby Faker::Movies::HitchhikersGuideToTheGalaxy.quote #=> "In the beginning, the Universe was created. This has made a lot of people very angry and been widely regarded as a bad move." ``` ```ruby Faker::Movies::HitchhikersGuideToTheGalaxy.specie #=> "Perfectly Normal Beast" ``` ```ruby Faker::Movies::HitchhikersGuideToTheGalaxy.starship #=> "Vogon Constructor Fleet" ``` -------------------------------- ### Get Restaurant Information Source: https://github.com/faker-ruby/faker/wiki/All-functions Generates random restaurant names, types, descriptions, and reviews. ```ruby Faker::Restaurant.name ``` ```ruby Faker::Restaurant.type ``` ```ruby Faker::Restaurant.description ``` ```ruby Faker::Restaurant.review ``` -------------------------------- ### Deprecated Generator Usage Example Source: https://github.com/faker-ruby/faker/blob/main/CONTRIBUTING.md Demonstrates calling a deprecated generator and the expected deprecation warning output. ```ruby Faker::IDNumber.valid #=> "552-56-3593" ## Deprecation warning DEPRECATION WARNING: Faker::IDNumber is deprecated. Use Faker::IdNumber instead. ``` -------------------------------- ### Generate Application Name Source: https://github.com/faker-ruby/faker/blob/main/doc/default/app.md Generates a fake application name. No specific setup is required. ```ruby Faker::App.name #=> "Treeflex" ``` -------------------------------- ### Faker::Internet Methods Source: https://github.com/faker-ruby/faker/wiki/Internet This section lists the available methods within the Faker::Internet module and provides examples of their usage. ```APIDOC ## Faker::Internet ### Description Provides methods to generate various internet-related data. ### Methods - **email** Generates a fake email address. Example: `Faker::Internet.email` - **safe_email** Generates a fake email address that is safe for use (e.g., using example.com). Example: `Faker::Internet.safe_email` - **free_email** Generates a fake email address from a free email provider (e.g., gmail.com). Example: `Faker::Internet.free_email` - **user_name** Generates a fake username. Example: `Faker::Internet.user_name` - **domain_name** Generates a fake domain name. Example: `Faker::Internet.domain_name` - **domain_word** Generates a fake word suitable for a domain name. Example: `Faker::Internet.domain_word` - **domain_suffix** Generates a fake domain suffix (e.g., com, org, net). Example: `Faker::Internet.domain_suffix` - **ip_v4_address** Generates a fake IPv4 address. Example: `Faker::Internet.ip_v4_address` - **ip_v6_address** Generates a fake IPv6 address. Example: `Faker::Internet.ip_v6_address` - **url** Generates a fake URL. Example: `Faker::Internet.url` ``` -------------------------------- ### Get a tea variety Source: https://github.com/faker-ruby/faker/blob/main/doc/default/tea.md Use this to get a random tea variety. Available since version next. ```ruby Faker::Tea.variety # => "Earl Grey" ``` -------------------------------- ### Generate Application Version Source: https://github.com/faker-ruby/faker/blob/main/doc/default/app.md Generates a fake application version number. No specific setup is required. ```ruby Faker::App.version #=> "1.85" ``` -------------------------------- ### Generate Volleyball Formation Source: https://github.com/faker-ruby/faker/blob/main/doc/sports/volleyball.md Use this to generate a random volleyball formation. No setup is required beyond including the Faker gem. ```ruby Faker::Sports::Volleyball.formation #=> "4-2" ``` -------------------------------- ### Generate D&D Background Source: https://github.com/faker-ruby/faker/blob/main/doc/games/dnd.md Generates a random D&D background. No setup required. ```ruby Faker::Games::DnD.background #=> "Urchin" ``` -------------------------------- ### Get Programming Language Name Source: https://github.com/faker-ruby/faker/blob/main/doc/default/programming_language.md Use this to generate a random programming language name. No setup is required. ```ruby Faker::ProgrammingLanguage.name #=> "Ruby" ``` -------------------------------- ### Generate 'Hello World' Code Sample Source: https://github.com/faker-ruby/faker/blob/main/doc/default/source.md Generates a 'Hello World' code sample. Specify the language using the 'lang' keyword argument. Defaults to Ruby. ```ruby Faker::Source.hello_world ``` ```javascript Faker::Source.hello_world(lang: :javascript) ``` -------------------------------- ### Generate Currency Name Source: https://github.com/faker-ruby/faker/blob/main/doc/default/currency.md Use this to generate a random currency name. No setup is required. ```ruby Faker::Currency.name #=> "Swedish Krona" ``` -------------------------------- ### Generate Application Author Source: https://github.com/faker-ruby/faker/blob/main/doc/default/app.md Generates a fake application author name. No specific setup is required. ```ruby Faker::App.author #=> "Daphne Swift" ``` -------------------------------- ### Basic Faker Usage Examples Source: https://github.com/faker-ruby/faker/blob/main/README.md Demonstrates how to generate various types of fake data using different Faker modules. Ensure `require 'faker'` is called before use. ```ruby require 'faker'\n\nFaker::Name.name #=> "Christophe Bartell" Faker::Internet.password #=> "Vg5mSvY1UeRg7" Faker::Internet.email #=> "eliza@mann.test" Faker::Address.full_address #=> "5479 William Way, East Sonnyhaven, LA 63637" Faker::Markdown.emphasis #=> "Quo qui aperiam. Amet corrupti distinctio. Sit quia *dolor.*" Faker::Lorem.paragraph #=> "Recusandae minima consequatur. Expedita sequi blanditiis. Ut fuga et." Faker::Alphanumeric.alpha(number: 10) #=> "zlvubkrwga" Faker::ProgrammingLanguage.name #=> "Ruby" ``` -------------------------------- ### Test Locale Functionality Source: https://github.com/faker-ruby/faker/blob/main/lib/locales/README.md An example of how to test the functionality of a specific locale by asserting the type of generated data. ```ruby assert Faker::Hipster.word.is_a? String ``` -------------------------------- ### Get Grateful Dead Song Title Source: https://github.com/faker-ruby/faker/blob/main/doc/music/grateful_dead.md Returns a random Grateful Dead song title. No setup required. ```ruby Faker::Music::GratefulDead.song #=> "Cassidy" ``` -------------------------------- ### Faker::Source.hello_world Source: https://github.com/faker-ruby/faker/blob/main/doc/default/source.md Generates a 'Hello World!' code snippet. Defaults to Ruby, but can specify other languages. ```APIDOC ## Faker::Source.hello_world ### Description Generates a 'Hello World!' code snippet. Defaults to Ruby, but can specify other languages. ### Method Signature `Faker::Source.hello_world(lang: :ruby)` ### Parameters #### Keyword Arguments - **lang** (Symbol) - Optional - The programming language for the snippet. Defaults to `:ruby`. ### Request Example ```ruby Faker::Source.hello_world Faker::Source.hello_world(lang: :javascript) ``` ### Response Example ```ruby #=> "print 'Hello World!'" #=> "alert('Hello World!');" ``` ``` -------------------------------- ### Generate Aqua Teen Hunger Force Quote Source: https://github.com/faker-ruby/faker/blob/main/doc/tv_shows/aqua_teen_hunger_force.md Use this method to get a random quote from the show. No setup is required. ```ruby Faker::TvShows::AquaTeenHungerForce.quote #=> "Listen to me, Randy. It doesn't matter what you look like on the outside-- whether you're white or black or a sasquatch even-- as long as you follow your dream, no matter how crazy or against the law it is, except for a sasquatch. If you're a sasquatch, the rules are different." ``` -------------------------------- ### Benchmark Comparison: Require vs. Autoload Source: https://github.com/faker-ruby/faker/blob/main/experiments/zeitwerk.md This benchmark demonstrates the performance difference between standard 'require' and Zeitwerk's 'autoload' for loading the Faker gem. Autoloading shows a significant speed improvement. ```sh benchmark % ruby load.rb ruby 3.3.10 (2025-10-23 revision 343ea05002) [arm64-darwin24] Warming up -------------------------------------- require 1.000 i/100ms autoload 1.000 i/100ms Calculating ------------------------------------- require 6.026 (± 0.0%) i/s (165.96 ms/i) - 31.000 in 5.145463s autoload 11.730 (± 0.0%) i/s (85.25 ms/i) - 59.000 in 5.032426s Comparison: require: 6.0 i/s autoload: 11.7 i/s - 1.95x faster ``` -------------------------------- ### Benchmark Comparison: require vs. lazyload Source: https://github.com/faker-ruby/faker/blob/main/experiments/lazy_load.md Compares the performance of standard `require` against the lazy loading implementation. The lazy loading approach shows a significant speed improvement. ```sh benchmark % ruby load.rb ruby 3.3.10 (2025-10-23 revision 343ea05002) [arm64-darwin24] Warming up -------------------------------------- require 1.000 i/100ms lazyload 1.000 i/100ms Calculating ------------------------------------- require 4.698 (± 0.0%) i/s (212.88 ms/i) - 24.000 in 5.133782s lazyload 9.751 (± 0.0%) i/s (102.55 ms/i) - 49.000 in 5.032161s Comparison: require: 4.7 i/s lazyload: 9.8 i/s - 2.08x faster ``` -------------------------------- ### Generate Aqua Teen Hunger Force Character Source: https://github.com/faker-ruby/faker/blob/main/doc/tv_shows/aqua_teen_hunger_force.md Use this method to get a random character name from the show. No setup is required. ```ruby Faker::TvShows::AquaTeenHungerForce.character #=> "Master Shake" ``` -------------------------------- ### Download Placeholder Image to File Source: https://github.com/faker-ruby/faker/blob/main/doc/default/placeholdit.md Creates a temporary file and downloads a placeholder image generated by Faker::Placeholdit into it. This is useful for testing scenarios where you need to access the image file itself. ```ruby def image_file(size: '300x300', format: 'png', background_color: nil, text_color: nil, text: nil) file = Tempfile.new("faker_placeholdit") file.binmode file << Net::HTTP.get(URI(Faker::Placeholdit.image(size: size, format: format, background_color: background_color, text_color: text_color, text: text))) file.close ::File.new(file.path) end ``` -------------------------------- ### Generate Currency Code Source: https://github.com/faker-ruby/faker/blob/main/doc/default/currency.md Use this to generate a random currency code (e.g., USD, EUR). No setup is required. ```ruby Faker::Currency.code #=> "USD" ``` -------------------------------- ### Generate Hello World or Print Statements Source: https://github.com/faker-ruby/faker/wiki/All-functions Generates 'Hello World!' strings or custom print statements. Supports Ruby and JavaScript output. ```ruby Faker::Source.hello_world ``` ```javascript Faker::Source.hello_world(:javascript) ``` ```ruby Faker::Source.print ``` ```ruby Faker::Source.print('cake') ``` ```javascript Faker::Source.print(str: 'cake', lang: :javascript) ``` -------------------------------- ### Get Grateful Dead Player Name Source: https://github.com/faker-ruby/faker/blob/main/doc/music/grateful_dead.md Returns a random Grateful Dead band member's name. No setup required. ```ruby Faker::Music::GratefulDead.player #=> "Jerry Garcia" ``` -------------------------------- ### Generate City Source: https://github.com/faker-ruby/faker/blob/main/doc/default/address.md Generates a fake city name. No specific setup is required. ```ruby Faker::Address.city #=> "Imogeneborough" ``` -------------------------------- ### Generate South Park Quote Source: https://github.com/faker-ruby/faker/blob/main/doc/tv_shows/south_park.md Use this to get a random quote from South Park. No setup is required beyond including the Faker gem. ```ruby Faker::TvShows::SouthPark.quote #=> "I'm just getting a little cancer Stan" ``` -------------------------------- ### Run All Tests and RuboCop Source: https://github.com/faker-ruby/faker/blob/main/CONTRIBUTING.md Execute this command to run the entire test suite and the RuboCop static code analyzer. ```ruby bundle exec rake ``` -------------------------------- ### Faker::Device Methods Source: https://github.com/faker-ruby/faker/blob/main/doc/default/device.md This section provides examples of how to use the various methods available in the Faker::Device module to generate different types of fake device data. ```APIDOC ## Faker::Device Available since version 1.9.0. ### Methods - **build_number** - Description: Generates a fake build number for a device. - Example: ```ruby Faker::Device.build_number #=> "5" ``` - **manufacturer** - Description: Generates a fake device manufacturer name. - Example: ```ruby Faker::Device.manufacturer #=> "Apple" ``` - **model_name** - Description: Generates a fake device model name. - Example: ```ruby Faker::Device.model_name #=> "iPhone 4" ``` - **platform** - Description: Generates a fake device platform name. - Example: ```ruby Faker::Device.platform #=> "webOS" ``` - **serial** - Description: Generates a fake device serial number. - Example: ```ruby Faker::Device.serial #=> "ejfjnRNInxh0363JC2WM" ``` - **version** - Description: Generates a fake device version number. - Example: ```ruby Faker::Device.version #=> "4" ``` ``` -------------------------------- ### Generate South Park Character Source: https://github.com/faker-ruby/faker/blob/main/doc/tv_shows/south_park.md Use this to get a random character name from South Park. No setup is required beyond including the Faker gem. ```ruby Faker::TvShows::SouthPark.character #=> "Mr. Garrison" ``` -------------------------------- ### Generate Random Touhou Game Source: https://github.com/faker-ruby/faker/blob/main/doc/games/touhou.md Use this method to get a random Touhou game title. No setup is required beyond including the Faker gem. ```ruby Faker::Games::Touhou.game #=> "Mountain of Faith" ``` -------------------------------- ### Require Faker and Use Internet Helpers Source: https://github.com/faker-ruby/faker/wiki/Internet To use Faker's internet helpers, you need to require the gem. This setup is typically done in an IRB session or a Ruby script. ```ruby require 'rubygems' require 'faker' ``` -------------------------------- ### Generate South Park Episode Name Source: https://github.com/faker-ruby/faker/blob/main/doc/tv_shows/south_park.md Use this to get a random episode name from South Park. No setup is required beyond including the Faker gem. ```ruby Faker::TvShows::SouthPark.episode_name #=> "Make Love, Not Warcraft" ``` -------------------------------- ### Generate Ghostbusters Actor Source: https://github.com/faker-ruby/faker/blob/main/doc/movies/ghostbusters.md Use this method to get a random actor's name from the Ghostbusters movies. No specific setup is required beyond requiring the Faker library. ```ruby Faker::Movies::Ghostbusters.actor #=> "Bill Murray" ``` -------------------------------- ### Generate Restaurant Review Source: https://github.com/faker-ruby/faker/blob/main/doc/default/restaurant.md Generates a sample customer review for a restaurant, including comments on ambiance, music, and food. ```ruby Faker::Restaurant.review #=> "Brand new. Great design. Odd to hear pop music in a Mexican establishment. Music is a bit loud. It should be background." ``` -------------------------------- ### Generate Random Touhou Spell Card Source: https://github.com/faker-ruby/faker/blob/main/doc/games/touhou.md Use this method to get a random Touhou spell card name. No specific setup is needed if Faker is already included. ```ruby Faker::Games::Touhou.spell_card #=> 'Esoterica "Gray Thaumaturgy"' ``` -------------------------------- ### Generate Loop Code Sample (1 to 10) Source: https://github.com/faker-ruby/faker/blob/main/doc/default/source.md Generates a code sample for a loop that iterates from 1 to 10. Specify the language using the 'lang' keyword argument. Defaults to Ruby. ```ruby Faker::Source.print_1_to_10 <<-DOC 10.times do |i| print i end DOC ``` ```javascript Faker::Source.print_1_to_10(lang: :javascript) <<-DOC for (let i=0; i<10; i++) { console.log(i); } DOC ``` -------------------------------- ### Generate The Room Movie Data Source: https://github.com/faker-ruby/faker/blob/main/doc/movies/the_room.md Use these methods to generate random actors, characters, locations, or quotes from 'The Room'. No additional setup is required after installing the Faker gem. ```ruby Faker::Movies::TheRoom.actor #=> "Tommy Wiseau" ``` ```ruby Faker::Movies::TheRoom.character #=> "Johnny" ``` ```ruby Faker::Movies::TheRoom.location #=> "Johnny's Apartment" ``` ```ruby Faker::Movies::TheRoom.quote #=> "A-ha-ha-ha! What a story, Mark!" ``` -------------------------------- ### Generate Horse Name and Breed in Ruby Source: https://github.com/faker-ruby/faker/blob/main/doc/creature/horse.md Use Faker::Creature::Horse.name to generate a random horse name and Faker::Creature::Horse.breed to generate a random horse breed. No additional setup is required beyond installing the Faker gem. ```ruby Faker::Creature::Horse.name #=> "Noir" ``` ```ruby Faker::Creature::Horse.breed #=> "Spanish Barb see Barb Horse" ``` -------------------------------- ### Run the Faker Test Suite Source: https://github.com/faker-ruby/faker/blob/main/CONTRIBUTING.md Execute this command to run all the tests for the Faker gem. ```ruby bundle exec rake test ``` -------------------------------- ### Get a type of tea Source: https://github.com/faker-ruby/faker/blob/main/doc/default/tea.md Use this to get a random type of tea. Available types include 'Black', 'Green', 'Herbal', 'Oolong', 'White'. ```ruby Faker::Tea.type #=> "Herbal" ``` -------------------------------- ### Generate Coffee Tasting Notes Source: https://github.com/faker-ruby/faker/blob/main/doc/default/coffee.md Use this method to generate random tasting notes for coffee. ```ruby Faker::Coffee.notes #=> "balanced, silky, marzipan, orange-creamsicle, bergamot" ``` -------------------------------- ### Generate multiple Lorem Ipsum questions Source: https://github.com/faker-ruby/faker/blob/main/doc/default/lorem.md Generates an array of questions. You can specify the number of questions and whether to include supplemental words. ```ruby Faker::Lorem.questions(number: 3) ``` ```ruby Faker::Lorem.questions(number: 3, supplemental: false) ``` -------------------------------- ### Download Placeholder Image as File Source: https://github.com/faker-ruby/faker/blob/main/doc/default/placeholdit.md Provides a helper method to download the generated placeholder image and save it as a temporary file. ```APIDOC ## Helper Method for Downloading Image File ### Description This method downloads the placeholder image generated by `Faker::Placeholdit.image` and saves it to a temporary file, returning a `File` object. ### Method `image_file(options)` ### Parameters #### Keyword Arguments - **size** (String) - Optional - The desired size of the image (e.g., '300x300'). Defaults to '300x300'. - **format** (String) - Optional - The desired image format (e.g., 'png'). Defaults to 'png'. - **background_color** (String or Symbol) - Optional - The background color for the image. - **text_color** (String) - Optional - The text color for the image. - **text** (String) - Optional - The text to display on the image. ### Example ```ruby def image_file(size: '300x300', format: 'png', background_color: nil, text_color: nil, text: nil) file = Tempfile.new("faker_placeholdit") file.binmode file << Net::HTTP.get(URI(Faker::Placeholdit.image(size: size, format: format, background_color: background_color, text_color: text_color, text: text))) file.close ::File.new(file.path) end ``` ``` -------------------------------- ### Get a tea variety by type Source: https://github.com/faker-ruby/faker/blob/main/doc/default/tea.md Use this to get a random tea variety of a specific type. Accepted types are 'Black', 'Green', 'Herbal', 'Oolong', 'White'. ```ruby Faker::Tea.variety(type: 'Green') #=> "Jasmine" ``` -------------------------------- ### Generate Domain Suffix Source: https://github.com/faker-ruby/faker/blob/main/doc/default/internet.md Generates a domain suffix, with an option to ensure it's a safe suffix like 'example' or 'test'. ```ruby Faker::Internet.domain_suffix #=> "info" ``` ```ruby Faker::Internet.domain_suffix(safe: true) #=> "example" ``` -------------------------------- ### Faker::Markdown.sandwich(sentences: number) Source: https://github.com/faker-ruby/faker/blob/main/doc/default/markdown.md Creates a simulated blog-esque text-heavy block in markdown with a specified number of sentences for the lorem paragraph. ```APIDOC ## Faker::Markdown.sandwich(sentences: number) ### Description Creates a simulated blog-esque text-heavy block in markdown with a specified number of sentences for the lorem paragraph. ### Method `Faker::Markdown.sandwich(sentences: 5)` ### Parameters #### Keyword Arguments - **sentences** (integer) - Required - The number of sentences for the lorem paragraph. ### Response Example ``` "(returns newline separated content of 1 header, 1 5-sentence lorem paragraph, and 1 random markdown element)" ``` ``` -------------------------------- ### Generate Appliance Brand and Equipment Source: https://github.com/faker-ruby/faker/blob/main/doc/default/appliance.md Use Faker::Appliance.brand to get a random brand name and Faker::Appliance.equipment to get a random equipment type. These methods are useful for populating forms or databases with sample appliance data. ```ruby Faker::Appliance.brand #=> "Bosch" ``` ```ruby Faker::Appliance.equipment #=> "Appliance plug" ``` -------------------------------- ### Get Quote Source: https://github.com/faker-ruby/faker/blob/main/doc/tv_shows/the_office.md Returns a random quote from The Office. ```APIDOC ## GET /quote ### Description Retrieves a random quote from The Office. ### Method GET ### Endpoint /quote ### Response #### Success Response (200) - **quote** (string) - A quote from The Office. ``` -------------------------------- ### Generate Subscription Details with Faker Source: https://github.com/faker-ruby/faker/blob/main/doc/default/subscription.md Use these methods to generate common subscription attributes. No specific setup is required beyond including the Faker library. ```ruby Faker::Subscription.plan #=> "Platinum" ``` ```ruby Faker::Subscription.status #=> "Active" ``` ```ruby Faker::Subscription.payment_method #=> "Paypal" ``` ```ruby Faker::Subscription.subscription_term #=> "Annual" ``` ```ruby Faker::Subscription.payment_term #=> "Monthly" ``` -------------------------------- ### Generate User Data (Username, Email, Password) Source: https://github.com/faker-ruby/faker/blob/main/doc/default/internet.md Generates a hash containing username, email, and optionally password. Useful for creating mock user credentials. ```ruby Faker::Internet.user #=> { username: 'alexie', email: 'trudie@grant.test' } ``` ```ruby Faker::Internet.user('username', 'email', 'password') #=> { username: 'alexie', email: 'gayle@kohler.test', password: 'DtEf9P8wS31iMyC' } ``` -------------------------------- ### Get Quote Source: https://github.com/faker-ruby/faker/blob/main/doc/movies/departed.md Generates a fake quote from The Departed. ```APIDOC ## quote ### Description Generates a fake quote from The Departed. ### Method ```ruby Faker::Movies::Departed.quote ``` ### Response Example ```json { "example": "I'm the guy who does his job. You must be the other guy" } ``` ``` -------------------------------- ### Get Character Source: https://github.com/faker-ruby/faker/blob/main/doc/tv_shows/the_office.md Returns a random character name from The Office. ```APIDOC ## GET /character ### Description Retrieves a random character from The Office. ### Method GET ### Endpoint /character ### Response #### Success Response (200) - **character** (string) - The name of a character from The Office. ``` -------------------------------- ### Generate Currency Symbol Source: https://github.com/faker-ruby/faker/blob/main/doc/default/currency.md Use this to generate a random currency symbol (e.g., $, €, £). No setup is required. ```ruby Faker::Currency.symbol #=> "$" ``` -------------------------------- ### Get Character Source: https://github.com/faker-ruby/faker/blob/main/doc/movies/departed.md Generates a fake character name from The Departed. ```APIDOC ## character ### Description Generates a fake character name from The Departed. ### Method ```ruby Faker::Movies::Departed.character ``` ### Response Example ```json { "example": "Frank Costello" } ``` ``` -------------------------------- ### Faker::Markdown.sandwich(sentences: number, repeat: number) Source: https://github.com/faker-ruby/faker/blob/main/doc/default/markdown.md Creates a simulated blog-esque text-heavy block in markdown with a specified number of sentences and repetitions. ```APIDOC ## Faker::Markdown.sandwich(sentences: number, repeat: number) ### Description Creates a simulated blog-esque text-heavy block in markdown with a specified number of sentences and repetitions. ### Method `Faker::Markdown.sandwich(sentences: 6, repeat: 3)` ### Parameters #### Keyword Arguments - **sentences** (integer) - Required - The number of sentences for the lorem paragraph. - **repeat** (integer) - Required - The number of times to repeat the paragraph-markdown pairing. ### Response Example ``` "(returns newline separated content of 1 header, and then 3 sections consisting of, here, 1 6-sentence lorem paragraph and 1 random markdown element. The random markdown element is chosen at random in each iteration of the paragraph-markdown pairing.)" ``` ``` -------------------------------- ### Generate Team Details Source: https://github.com/faker-ruby/faker/wiki/All-functions Generate team name, creature, state, sport, and mascot. ```ruby Faker::Team.creature Faker::Team.name Faker::Team.state Faker::Team.sport Faker::Team.mascot ``` -------------------------------- ### Generate D&D Race Source: https://github.com/faker-ruby/faker/blob/main/doc/games/dnd.md Generates a random D&D race. No setup required. ```ruby Faker::Games::DnD.race #=> "Dwarf" ``` -------------------------------- ### Generate D&D Language Source: https://github.com/faker-ruby/faker/blob/main/doc/games/dnd.md Generates a random D&D language. No setup required. ```ruby Faker::Games::DnD.language #=> "Gnomish" ``` -------------------------------- ### Generate Faker::Commerce Product Name Source: https://github.com/faker-ruby/faker/blob/main/doc/default/commerce.md Generates a realistic product name. No arguments are required. ```ruby Faker::Commerce.product_name #=> "Practical Granite Shirt" ``` -------------------------------- ### Generate Pearl Jam Album Source: https://github.com/faker-ruby/faker/blob/main/doc/music/pearl_jam.md Use this to generate a fake Pearl Jam album title. No setup required. ```ruby Faker::Music::PearlJam.album #=> "Ten" ``` -------------------------------- ### Faker::HarryPotter Methods Source: https://github.com/faker-ruby/faker/blob/main/doc/default/harry_potter.md This section details the available methods within the Faker::HarryPotter module for generating fake data. ```APIDOC ## Faker::HarryPotter ### Description Provides methods to generate fake data related to the Harry Potter universe. ### Methods #### `character` Generates a random Harry Potter character name. **Example:** ```ruby Faker::HarryPotter.character ``` #### `location` Generates a random Harry Potter location. **Example:** ```ruby Faker::HarryPotter.location ``` #### `quote` Generates a random Harry Potter quote. **Example:** ```ruby Faker::HarryPotter.quote ``` #### `book` Generates a random Harry Potter book title. **Example:** ```ruby Faker::HarryPotter.book ``` #### `house` Generates a random Harry Potter house name. **Example:** ```ruby Faker::HarryPotter.house ``` #### `spell` Generates a random Harry Potter spell name. **Example:** ```ruby Faker::HarryPotter.spell ``` ``` -------------------------------- ### Generate D&D Alignment Source: https://github.com/faker-ruby/faker/blob/main/doc/games/dnd.md Generates a random D&D alignment. No setup required. ```ruby Faker::Games::DnD.alignment #=> "Lawful Neutral" ``` -------------------------------- ### Generate Print Statement Code Sample Source: https://github.com/faker-ruby/faker/blob/main/doc/default/source.md Generates a print statement code sample. You can specify the string to print using 'str' and the language using 'lang'. Defaults to Ruby. ```ruby Faker::Source.print ``` ```ruby Faker::Source.print(str: 'cake') ``` ```javascript Faker::Source.print(str: 'cake', lang: :javascript) ``` -------------------------------- ### Generate Lorem Ipsum Paragraph Source: https://github.com/faker-ruby/faker/blob/main/doc/default/lorem.md Generates a Lorem Ipsum paragraph. Use `sentence_count` to specify the number of sentences. `supplemental` includes sentences from a supplementary list. `random_sentences_to_add` adds a random number of sentences (0 to the specified value) to the paragraph. ```ruby Faker::Lorem.paragraph #=> "Recusandae minima consequatur. Expedita sequi blanditiis. Ut fuga et." ``` ```ruby Faker::Lorem.paragraph(sentence_count: 2) #=> "Ducimus mollitia deserunt. Dicta et corporis." ``` ```ruby Faker::Lorem.paragraph(sentence_count: 2, supplemental: true) #=> "Strues amplitudo dignissimos. Ver trucido charisma." ``` ```ruby Faker::Lorem.paragraph(sentence_count: 2, supplemental: false, random_sentences_to_add: 4) #=> "Neque aut et nemo aut incidunt voluptates. Dolore cum est sint est. Vitae assumenda porro odio dolores fugiat. Est voluptatum quia rerum." ``` ```ruby Faker::Lorem.paragraph(sentence_count: 2, supplemental: true, random_sentences_to_add: 4) #=> "Vomito unde uxor annus. Et patior utilis sursum." ``` -------------------------------- ### Get Robin Quote Source: https://github.com/faker-ruby/faker/wiki/All-functions Generates random quotes attributed to Robin. ```ruby Faker::Robin.quote ``` -------------------------------- ### Get Actor Source: https://github.com/faker-ruby/faker/blob/main/doc/movies/departed.md Generates a fake actor's name from The Departed. ```APIDOC ## actor ### Description Generates a fake actor's name from The Departed. ### Method ```ruby Faker::Movies::Departed.actor ``` ### Response Example ```json { "example": "Matt Damon" } ``` ``` -------------------------------- ### Generate Markdown Sandwich with Specific Sentences Source: https://github.com/faker-ruby/faker/wiki/All-functions Returns newline-separated content of one header, one lorem paragraph with a specified number of sentences, and one random markdown element. ```ruby Faker::Markdown.sandwich(sentences: 5) ``` -------------------------------- ### Quote Source: https://github.com/faker-ruby/faker/blob/main/doc/default/hitchhikers_guide_to_the_galaxy.md Generates a random quote from The Hitchhiker's Guide to the Galaxy. ```APIDOC ## Faker::HitchhikersGuideToTheGalaxy.quote ### Description Generates a random quote. ### Method `Faker::HitchhikersGuideToTheGalaxy.quote` ### Response Example ```json { "example": "In the beginning, the Universe was created. This has made a lot of people very angry and been widely regarded as a bad move." } ``` ``` -------------------------------- ### Reformat YAML File Source: https://github.com/faker-ruby/faker/blob/main/CONTRIBUTING.md Use this command to reformat YAML files in the lib/path/to/file.yml directory. This ensures consistent formatting across the project. ```bash bundle exec rake reformat_yaml['lib/path/to/file.yml'] ``` -------------------------------- ### Location Source: https://github.com/faker-ruby/faker/blob/main/doc/default/hitchhikers_guide_to_the_galaxy.md Generates a random location from The Hitchhiker's Guide to the Galaxy. ```APIDOC ## Faker::HitchhikersGuideToTheGalaxy.location ### Description Generates a random location. ### Method `Faker::HitchhikersGuideToTheGalaxy.location` ### Response Example ```json { "example": "Arthur Dent's house" } ``` ``` -------------------------------- ### Generate D&D Monster Source: https://github.com/faker-ruby/faker/blob/main/doc/games/dnd.md Generates a random D&D monster name. No setup required. ```ruby Faker::Games::DnD.monster #=> "Manticore" ``` -------------------------------- ### Generate Lorem Ipsum Sentence Source: https://github.com/faker-ruby/faker/blob/main/doc/default/lorem.md Generates a Lorem Ipsum sentence. Use `word_count` to specify the number of words. `supplemental` includes words from a supplementary list. `random_words_to_add` adds a random number of words (0 to the specified value) to the sentence. ```ruby Faker::Lorem.sentence #=> "Quia illum libero magni." ``` ```ruby Faker::Lorem.sentence(word_count: 3) #=> "Quaerat quam unde." ``` ```ruby Faker::Lorem.sentence(word_count: 3, supplemental: true) #=> "Vehemens velit cogo." ``` ```ruby Faker::Lorem.sentence(word_count: 3, supplemental: false, random_words_to_add: 4) #=> "Aut voluptatem illum fugit ut sit." ``` ```ruby Faker::Lorem.sentence(word_count: 3, supplemental: true, random_words_to_add: 4) #=> "Accusantium tantillus dolorem timor." ``` -------------------------------- ### Generate D&D Class Source: https://github.com/faker-ruby/faker/blob/main/doc/games/dnd.md Generates a random D&D character class. No setup required. ```ruby Faker::Games::DnD.klass #=> "Warlock" ``` -------------------------------- ### Faker::Dessert Methods Source: https://github.com/faker-ruby/faker/blob/main/doc/default/dessert.md Provides methods to generate random dessert varieties, toppings, and flavors. ```APIDOC ## Faker::Dessert Available since version 1.8.0. ### Methods - **variety** - Generates a random dessert variety. - **topping** - Generates a random dessert topping. - **flavor** - Generates a random dessert flavor. ### Example Usage ```ruby # Random dessert variety Faker::Dessert.variety #=> "Cake" # Random dessert topping Faker::Dessert.topping #=> "Gummy Bears" # Random dessert flavor Faker::Dessert.flavor #=> "Salted Caramel" ``` ``` -------------------------------- ### Get Singular Siegler Quote Source: https://github.com/faker-ruby/faker/wiki/All-functions Generates a random quote from Singular Siegler. ```ruby Faker::SingularSiegler.quote ``` -------------------------------- ### Get Rock Band Name Source: https://github.com/faker-ruby/faker/wiki/All-functions Generates a random rock band name. ```ruby Faker::RockBand.name ``` -------------------------------- ### Faker::Music Methods Source: https://github.com/faker-ruby/faker/blob/main/doc/music/music.md This snippet demonstrates how to use various methods within the Faker::Music module to generate different types of music-related data. ```APIDOC ## Faker::Music Available since version 1.6.4. ### Methods - **key** - Description: Generates a random musical key. - Example: `Faker::Music.key` #=> "C" - **chord** - Description: Generates a random musical chord. - Example: `Faker::Music.chord` #=> "Amaj7" - **instrument** - Description: Generates a random musical instrument. - Example: `Faker::Music.instrument` #=> "Ukelele" - **band** - Description: Generates a random band name. - Example: `Faker::Music.band` #=> "The Beatles" - **album** - Description: Generates a random album title. - Example: `Faker::Music.album` #=> "Sgt. Pepper's Lonely Hearts Club" - **genre** - Description: Generates a random music genre. - Example: `Faker::Music.genre` #=> "Rock" - **mambo_no_5** - Description: Generates a name from the song "Mambo No. 5". - Example: `Faker::Music.mambo_no_5` #=> "Monica" ``` -------------------------------- ### Generate URL Source: https://github.com/faker-ruby/faker/blob/main/doc/default/internet.md Generates a URL with options to specify the host, path, and scheme. Useful for creating mock web links. ```ruby Faker::Internet.url #=> "http://treutel.test/demarcus" ``` ```ruby Faker::Internet.url #=> "http://ullrich.example/fritz_braun" ``` ```ruby Faker::Internet.url(host: 'faker') #=> "http://faker/nakita" ``` ```ruby Faker::Internet.url(host: 'example.com') #=> "http://example.com/clotilde.swift" ``` ```ruby Faker::Internet.url(host: 'example.com', path: '/foobar.html') #=> "http://example.com/foobar.html" ``` -------------------------------- ### Get Programming Language Name Source: https://github.com/faker-ruby/faker/wiki/All-functions Returns a random programming language name. ```ruby Faker::ProgrammingLanguage.name ``` -------------------------------- ### Get a fake quote Source: https://github.com/faker-ruby/faker/blob/main/doc/tv_shows/dumb_and_dumber.md Returns a random quote from the movie Dumb and Dumber. ```APIDOC ## quote ### Description Returns a random quote from the movie Dumb and Dumber. ### Method `Faker::TvShows::DumbAndDumber.quote` ### Response Example ```json { "example": "Why you going to the airport? Flying somewhere?" } ``` ``` -------------------------------- ### Generate Marketing Buzzwords - Ruby Source: https://github.com/faker-ruby/faker/blob/main/doc/default/marketing.md Use the `buzzwords` method to generate a list of common marketing buzzwords. This is useful for creating placeholder marketing text. ```ruby Faker::Marketing.buzzwords #=> "rubber meets the road", "sprint to the finish line" ``` -------------------------------- ### Get As You Like It Quote Source: https://github.com/faker-ruby/faker/blob/main/doc/quotes/shakespeare.md Retrieves a random quote from Shakespeare's As You Like It. ```APIDOC ## Get As You Like It Quote ### Description Retrieves a random quote from Shakespeare's As You Like It. ### Method GET ### Endpoint /quotes/shakespeare/as_you_like_it ### Parameters None ### Request Example None ### Response #### Success Response (200) - **quote** (string) - A random quote from As You Like It. ``` -------------------------------- ### Generate Restaurant Description Source: https://github.com/faker-ruby/faker/blob/main/doc/default/restaurant.md Creates a descriptive text for a restaurant, often highlighting ingredient quality or culinary philosophy. ```ruby Faker::Restaurant.description #=> "We are committed to using the finest ingredients in our recipes. No food leaves our kitchen that we ourselves would not eat." ``` -------------------------------- ### Faker::Markdown.sandwich Source: https://github.com/faker-ruby/faker/blob/main/doc/default/markdown.md Creates a simulated blog-esque text-heavy block in markdown. ```APIDOC ## Faker::Markdown.sandwich ### Description Creates a simulated blog-esque text-heavy block in markdown. ### Method `Faker::Markdown.sandwich` ### Response Example ``` "(returns newline separated content of 1 header, 1 default lorem paragraph, and 1 random markdown element)" ``` ``` -------------------------------- ### Get Hamlet Quote Source: https://github.com/faker-ruby/faker/blob/main/doc/quotes/shakespeare.md Retrieves a random quote from Shakespeare's Hamlet. ```APIDOC ## Get Hamlet Quote ### Description Retrieves a random quote from Shakespeare's Hamlet. ### Method GET ### Endpoint /quotes/shakespeare/hamlet ### Parameters None ### Request Example None ### Response #### Success Response (200) - **quote** (string) - A random quote from Hamlet. ``` -------------------------------- ### Generate Rock Band Name and Song Source: https://github.com/faker-ruby/faker/blob/main/doc/music/rock_band.md Use Faker::Music::RockBand.name to generate a band name and Faker::Music::RockBand.song to generate a song title. No setup is required beyond including the Faker gem. ```ruby Faker::Music::RockBand.name #=> "Led Zeppelin" ``` ```ruby Faker::Music::RockBand.song #=> "Dream On" ``` -------------------------------- ### Get a Rajnikanth Joke Source: https://github.com/faker-ruby/faker/blob/main/doc/quotes/rajnikanth.md This method generates a random joke attributed to Rajnikanth. ```APIDOC ## Get a Rajnikanth Joke ### Description Generates a random joke attributed to Rajnikanth. ### Method ```ruby Faker::Quotes::Rajnikanth.joke ``` ### Response Example ```json { "example": "Rajinikanth can get rid of his shadow" } ``` ``` -------------------------------- ### Get a random location Source: https://github.com/faker-ruby/faker/blob/main/doc/movies/lord_of_the_rings.md Generates a random location name from The Lord of the Rings. ```APIDOC ## Get a random location ### Description Generates a random location name from The Lord of the Rings. ### Method ```ruby Faker::Movies::LordOfTheRings.location ``` ### Response Example ```json "Helm's Deep" ``` ``` -------------------------------- ### Generate a single Lorem Ipsum question Source: https://github.com/faker-ruby/faker/blob/main/doc/default/lorem.md Generates a single question. You can specify the word count and whether to include supplemental words. ```ruby Faker::Lorem.question ``` ```ruby Faker::Lorem.question(word_count: 4) ``` ```ruby Faker::Lorem.question(word_count: 4, supplemental: false) ``` ```ruby Faker::Lorem.question(word_count: 4, supplemental: false, random_words_to_add: 0) ``` -------------------------------- ### YAML Structure for New Locale Files Source: https://github.com/faker-ruby/faker/blob/main/lib/locales/en/README.md Use this YAML structure as the starting point for any new locale data file added to the English locale directory. ```yaml en: faker: ``` -------------------------------- ### Get a random character Source: https://github.com/faker-ruby/faker/blob/main/doc/movies/lord_of_the_rings.md Generates a random character name from The Lord of the Rings. ```APIDOC ## Get a random character ### Description Generates a random character name from The Lord of the Rings. ### Method ```ruby Faker::Movies::LordOfTheRings.character ``` ### Response Example ```json "Legolas" ``` ``` -------------------------------- ### Generate University Details Source: https://github.com/faker-ruby/faker/wiki/All-functions Generate university name, prefix, suffix, and Greek organization/alphabet. ```ruby Faker::University.name Faker::University.prefix Faker::University.suffix Faker::University.greek_organization Faker::University.greek_alphabet ``` -------------------------------- ### Starship Source: https://github.com/faker-ruby/faker/blob/main/doc/default/hitchhikers_guide_to_the_galaxy.md Generates a random starship name from The Hitchhiker's Guide to the Galaxy. ```APIDOC ## Faker::HitchhikersGuideToTheGalaxy.starship ### Description Generates a random starship name. ### Method `Faker::HitchhikersGuideToTheGalaxy.starship` ### Response Example ```json { "example": "Vogon Constructor Fleet" } ``` ``` -------------------------------- ### Faker::Commerce.product_name Source: https://github.com/faker-ruby/faker/blob/main/doc/default/commerce.md Generates a fake product name. ```APIDOC ## Faker::Commerce.product_name ### Description Generates a fake product name. ### Method ```ruby Faker::Commerce.product_name ``` ### Response Example ```json "Practical Granite Shirt" ``` ``` -------------------------------- ### Species Source: https://github.com/faker-ruby/faker/blob/main/doc/default/hitchhikers_guide_to_the_galaxy.md Generates a random species name from The Hitchhiker's Guide to the Galaxy. ```APIDOC ## Faker::HitchhikersGuideToTheGalaxy.specie ### Description Generates a random species name. ### Method `Faker::HitchhikersGuideToTheGalaxy.specie` ### Response Example ```json { "example": "Perfectly Normal Beast" } ``` ``` -------------------------------- ### Planet Source: https://github.com/faker-ruby/faker/blob/main/doc/default/hitchhikers_guide_to_the_galaxy.md Generates a random planet name from The Hitchhiker's Guide to the Galaxy. ```APIDOC ## Faker::HitchhikersGuideToTheGalaxy.planet ### Description Generates a random planet name. ### Method `Faker::HitchhikersGuideToTheGalaxy.planet` ### Response Example ```json { "example": "Magrathea" } ``` ``` -------------------------------- ### Generate a Lorem Ipsum paragraph by characters Source: https://github.com/faker-ruby/faker/blob/main/doc/default/lorem.md Generates a paragraph of text with a specified character count. You can also control whether to include supplemental words. ```ruby Faker::Lorem.paragraph_by_chars ``` ```ruby Faker::Lorem.paragraph_by_chars(number: 256, supplemental: false) ``` -------------------------------- ### Generate Lorem Ipsum Paragraphs Source: https://github.com/faker-ruby/faker/blob/main/doc/default/lorem.md Generates an array of Lorem Ipsum paragraphs. Use `number` to specify the count and `supplemental` to include paragraphs from a supplementary list. ```ruby Faker::Lorem.paragraphs #=> ["Dolores quis quia ad quo voluptates. Maxime delectus totam numquam. Necessitatibus vel atque qui dolore.", "Id neque nemo. Dolores iusto facere est ad. Accusamus ipsa dolor ut.", "Et officiis ut hic. Sunt asperiores minus distinctio debitis ipsa dolor. Minima eos deleniti."] ``` ```ruby Faker::Lorem.paragraphs(number: 1) #=> ["Labore voluptas sequi. Ratione nulla eaque quia molestiae fugit. At quam laboriosam aut ut dignissimos."] ``` ```ruby Faker::Lorem.paragraphs(number: 1, supplemental: true) #=> ["Depulso animi cunctatio amicitia adficio. Vester viduo qui despirmatio voluptas. Validus laudantium adopto ut agnitio venustas. Aer arcus odio esse."] ``` -------------------------------- ### Character Source: https://github.com/faker-ruby/faker/blob/main/doc/default/hitchhikers_guide_to_the_galaxy.md Generates a random character name from The Hitchhiker's Guide to the Galaxy. ```APIDOC ## Faker::HitchhikersGuideToTheGalaxy.character ### Description Generates a random character name. ### Method `Faker::HitchhikersGuideToTheGalaxy.character` ### Response Example ```json { "example": "Marvin" } ``` ``` -------------------------------- ### Generate D&D Ranged Weapon Source: https://github.com/faker-ruby/faker/blob/main/doc/games/dnd.md Generates a random D&D ranged weapon. No setup required. ```ruby Faker::Games::DnD.ranged_weapon #=> "Shortbow" ``` -------------------------------- ### Generate Lorem Ipsum Sentences Source: https://github.com/faker-ruby/faker/blob/main/doc/default/lorem.md Generates an array of Lorem Ipsum sentences. Use `number` to specify the count and `supplemental` to include words from a supplementary list. ```ruby Faker::Lorem.sentences #=> ["Vero earum commodi soluta.", "Quaerat fuga cumque et vero eveniet omnis ut.", "Cumque sit dolor ut est consequuntur."] ``` ```ruby Faker::Lorem.sentences(number: 1) #=> ["Ut perspiciatis explicabo possimus doloribus enim quia."] ``` ```ruby Faker::Lorem.sentences(number: 1, supplemental: true) #=> ["Quis capillus curo ager veritatis voro et ipsum."] ```