repo
stringlengths
5
92
file_url
stringlengths
80
287
file_path
stringlengths
5
197
content
stringlengths
0
32.8k
language
stringclasses
1 value
license
stringclasses
7 values
commit_sha
stringlengths
40
40
retrieved_at
stringdate
2026-01-04 15:37:27
2026-01-04 17:58:21
truncated
bool
2 classes
faker-ruby/faker
https://github.com/faker-ruby/faker/blob/a4d5e503edda970fc085e942018ee235622bfb11/lib/faker/tv_shows/rick_and_morty.rb
lib/faker/tv_shows/rick_and_morty.rb
# frozen_string_literal: true module Faker class TvShows class RickAndMorty < Base flexible :rick_and_morty class << self ## # Produces a character from Rick and Morty. # # @return [String] # # @example # Faker::TvShows::RickAndMorty.character #=> "Rick Sanchez" # # @faker.version 1.8.0 def character fetch('rick_and_morty.characters') end ## # Produces a location from Rick and Morty. # # @return [String] # # @example # Faker::TvShows::RickAndMorty.location #=> "Dimension C-132" # # @faker.version 1.8.0 def location fetch('rick_and_morty.locations') end ## # Produces a quote from Rick and Morty. # # @return [String] # # @example # Faker::TvShows::RickAndMorty.quote # #=> "Ohh yea, you gotta get schwifty." # # @faker.version 1.8.0 def quote fetch('rick_and_morty.quotes') end end end end end
ruby
MIT
a4d5e503edda970fc085e942018ee235622bfb11
2026-01-04T15:37:50.353881Z
false
faker-ruby/faker
https://github.com/faker-ruby/faker/blob/a4d5e503edda970fc085e942018ee235622bfb11/lib/faker/tv_shows/parks_and_rec.rb
lib/faker/tv_shows/parks_and_rec.rb
# frozen_string_literal: true module Faker class TvShows class ParksAndRec < Base flexible :parks_and_rec class << self ## # Produces a character from Parks and Recreation. # # @return [String] # # @example # Faker::TvShows::ParksAndRec.character #=> "Leslie Knope" # # @faker.version 1.9.0 def character fetch('parks_and_rec.characters') end ## # Produces a city from Parks and Recreation. # # @return [String] # # @example # Faker::TvShows::ParksAndRec.city #=> "Pawnee" # # @faker.version 1.9.0 def city fetch('parks_and_rec.cities') end end end end end
ruby
MIT
a4d5e503edda970fc085e942018ee235622bfb11
2026-01-04T15:37:50.353881Z
false
faker-ruby/faker
https://github.com/faker-ruby/faker/blob/a4d5e503edda970fc085e942018ee235622bfb11/lib/faker/tv_shows/seinfeld.rb
lib/faker/tv_shows/seinfeld.rb
# frozen_string_literal: true module Faker class TvShows class Seinfeld < Base flexible :seinfeld class << self ## # Produces a business from Seinfeld. # # @return [String] # # @example # Faker::TvShows::Seinfeld.business #=> "Kruger Industrial Smoothing" # # @faker.version 1.9.2 def business fetch('seinfeld.business') end ## # Produces a character from Seinfeld. # # @return [String] # # @example # Faker::TvShows::Seinfeld.character #=> "George Costanza" # # @faker.version 1.8.3 def character fetch('seinfeld.character') end ## # Produces a quote from Seinfeld. # # @return [String] # # @example # Faker::TvShows::Seinfeld.quote # #=> "I'm not a lesbian. I hate men, but I'm not a lesbian." # # @faker.version 1.8.3 def quote fetch('seinfeld.quote') end end end end end
ruby
MIT
a4d5e503edda970fc085e942018ee235622bfb11
2026-01-04T15:37:50.353881Z
false
faker-ruby/faker
https://github.com/faker-ruby/faker/blob/a4d5e503edda970fc085e942018ee235622bfb11/lib/faker/tv_shows/big_bang_theory.rb
lib/faker/tv_shows/big_bang_theory.rb
# frozen_string_literal: true module Faker class TvShows class BigBangTheory < Base flexible :big_bang_theory class << self ## # Produces a character from Big Bang Theory # # @return [String] # # @example # Faker::TvShows::BigBangTheory.character #=> "Sheldon Cooper" # # @faker.version 2.13.0 def character fetch('big_bang_theory.characters') end ## # Produces a quote from Bing Bang Theory # # @return [String] # # @example # Faker::TvShows::BigBangTheory.quote #=> "I'm not crazy. My mother had me tested." # # @faker.version 2.13.0 def quote fetch('big_bang_theory.quotes') end end end end end
ruby
MIT
a4d5e503edda970fc085e942018ee235622bfb11
2026-01-04T15:37:50.353881Z
false
faker-ruby/faker
https://github.com/faker-ruby/faker/blob/a4d5e503edda970fc085e942018ee235622bfb11/lib/faker/tv_shows/ru_paul.rb
lib/faker/tv_shows/ru_paul.rb
# frozen_string_literal: true module Faker class TvShows class RuPaul < Base flexible :rupaul class << self ## # Produces a quote from RuPaul's Drag Race. # # @return [String] # # @example # Faker::TvShows::RuPaul.quote #=> "That's Funny, Tell Another One." # # @faker.version 1.8.0 def quote fetch('rupaul.quotes') end ## # Produces a queen from RuPaul's Drag Race. # # @return [String] # # @example # Faker::TvShows::RuPaul.queen #=> "Latrice Royale" # # @faker.version 1.8.0 def queen fetch('rupaul.queens') end end end end end
ruby
MIT
a4d5e503edda970fc085e942018ee235622bfb11
2026-01-04T15:37:50.353881Z
false
faker-ruby/faker
https://github.com/faker-ruby/faker/blob/a4d5e503edda970fc085e942018ee235622bfb11/lib/faker/tv_shows/buffy.rb
lib/faker/tv_shows/buffy.rb
# frozen_string_literal: true module Faker class TvShows class Buffy < Base flexible :buffy class << self ## # Produces a character from Buffy the Vampire Slayer. # # @return [String] # # @example # Faker::TvShows::Buffy.character #=> "Buffy Summers" # # @faker.version 1.9.2 def character fetch('buffy.characters') end ## # Produces a quote from Buffy the Vampire Slayer. # # @return [String] # # @example # Faker::TvShows::Buffy.quote #=> "If the apocalypse comes, beep me." # # @faker.version 1.9.2 def quote fetch('buffy.quotes') end ## # Produces a actor from Buffy the Vampire Slayer. # # @return [String] # # @example # Faker::TvShows::Buffy.actor #=> "John Ritter" # # @faker.version next def actor fetch('buffy.actors') end ## # Produces a big bad from Buffy the Vampire Slayer. # # @return [String] # # @example # Faker::TvShows::Buffy.big_bad #=> "Glory" # # @faker.version 1.9.2 def big_bad fetch('buffy.big_bads') end ## # Produces an episode from Buffy the Vampire Slayer. # # @return [String] # # @example # Faker::TvShows::Buffy.episode #=> "Once More, with Feeling" # # @faker.version 1.9.2 def episode fetch('buffy.episodes') end end end end end
ruby
MIT
a4d5e503edda970fc085e942018ee235622bfb11
2026-01-04T15:37:50.353881Z
false
faker-ruby/faker
https://github.com/faker-ruby/faker/blob/a4d5e503edda970fc085e942018ee235622bfb11/lib/faker/tv_shows/suits.rb
lib/faker/tv_shows/suits.rb
# frozen_string_literal: true module Faker class TvShows class Suits < Base flexible :suits class << self ## # Produces a character from Suits. # # @return [String] # # @example # Faker::TvShows::Suits.character #=> "Harvey Specter" # # @faker.version 2.13.0 def character fetch('suits.characters') end ## # Produces a quote from Suits. # # @return [String] # # @example # Faker::TvShows::Suits.quote #=> "Don't play the odds, play the man." # # @faker.version 2.13.0 def quote fetch('suits.quotes') end end end end end
ruby
MIT
a4d5e503edda970fc085e942018ee235622bfb11
2026-01-04T15:37:50.353881Z
false
faker-ruby/faker
https://github.com/faker-ruby/faker/blob/a4d5e503edda970fc085e942018ee235622bfb11/lib/faker/tv_shows/breaking_bad.rb
lib/faker/tv_shows/breaking_bad.rb
# frozen_string_literal: true module Faker class TvShows class BreakingBad < Base flexible :breaking_bad class << self ## # Produces the name of a character from Breaking Bad. # # @return [String] # # @example # Faker::TvShows::BreakingBad.character #=> "Walter White" # # @faker.version 1.8.8 def character fetch('breaking_bad.character') end ## # Produces the name of an episode from Breaking Bad. # # @return [String] # # @example # Faker::TvShows::BreakingBad.episode #=> "Fly" # # @faker.version 1.8.8 def episode fetch('breaking_bad.episode') end end end end end
ruby
MIT
a4d5e503edda970fc085e942018ee235622bfb11
2026-01-04T15:37:50.353881Z
false
faker-ruby/faker
https://github.com/faker-ruby/faker/blob/a4d5e503edda970fc085e942018ee235622bfb11/lib/faker/tv_shows/twin_peaks.rb
lib/faker/tv_shows/twin_peaks.rb
# frozen_string_literal: true module Faker class TvShows class TwinPeaks < Base flexible :twin_peaks class << self ## # Produces a character from Twin Peaks. # # @return [String] # # @example # Faker::TvShows::TwinPeaks.character #=> "Dale Cooper" # # @faker.version 1.7.0 def character fetch('twin_peaks.characters') end ## # Produces a location from Twin Peaks. # # @return [String] # # @example # Faker::TvShows::TwinPeaks.location #=> "Black Lodge" # # @faker.version 1.7.0 def location fetch('twin_peaks.locations') end ## # Produces a quote from Twin Peaks. # # @return [String] # # @example # Faker::TvShows::TwinPeaks.quote # #=> "The owls are not what they seem." # # @faker.version 1.7.0 def quote fetch('twin_peaks.quotes') end end end end end
ruby
MIT
a4d5e503edda970fc085e942018ee235622bfb11
2026-01-04T15:37:50.353881Z
false
faker-ruby/faker
https://github.com/faker-ruby/faker/blob/a4d5e503edda970fc085e942018ee235622bfb11/lib/faker/tv_shows/simpsons.rb
lib/faker/tv_shows/simpsons.rb
# frozen_string_literal: true module Faker class TvShows class Simpsons < Base flexible :simpsons class << self ## # Produces a character from The Simpsons. # # @return [String] # # @example # Faker::TvShows::Simpsons.character #=> "Charles Montgomery Burns" # # @faker.version 1.8.0 def character fetch('simpsons.characters') end ## # Produces a location from The Simpsons. # # @return [String] # # @example # Faker::TvShows::Simpsons.location #=> "Moe's Tavern" # # @faker.version 1.8.0 def location fetch('simpsons.locations') end ## # Produces a quote from The Simpsons. # # @return [String] # # @example # Faker::TvShows::Simpsons.quote # #=> "It takes two to lie: one to lie and one to listen." # # @faker.version 1.8.0 def quote fetch('simpsons.quotes') end ## # Produces an episode title from The Simpsons. # # @return [String] # # @example # Faker::TvShows::Simpsons.episode_title # #=> "Two Cars in Every Garage and Three Eyes on Every Fish" # # @faker.version 2.13.0 def episode_title fetch('simpsons.episode_titles') end end end end end
ruby
MIT
a4d5e503edda970fc085e942018ee235622bfb11
2026-01-04T15:37:50.353881Z
false
faker-ruby/faker
https://github.com/faker-ruby/faker/blob/a4d5e503edda970fc085e942018ee235622bfb11/lib/faker/tv_shows/brooklyn_nine_nine.rb
lib/faker/tv_shows/brooklyn_nine_nine.rb
# frozen_string_literal: true module Faker class TvShows class BrooklynNineNine < Base flexible :brooklyn_nine_nine class << self ## # Produces a character from Brooklyn Nine Nine. # # @return [String] # # @example # Faker::TvShows::BrooklynNineNine.character #=> "Jake Peralta" # # @faker.version next def character fetch('brooklyn_nine_nine.characters') end ## # Produces a quote from Brooklyn Nine Nine. # # @return [String] # # @example # Faker::TvShows::BrooklynNineNine.quote # #=> "Cool, cool, cool, cool, cool. No doubt, no doubt, no doubt." # # @faker.version next def quote fetch('brooklyn_nine_nine.quotes') end end end end end
ruby
MIT
a4d5e503edda970fc085e942018ee235622bfb11
2026-01-04T15:37:50.353881Z
false
faker-ruby/faker
https://github.com/faker-ruby/faker/blob/a4d5e503edda970fc085e942018ee235622bfb11/lib/faker/tv_shows/the_expanse.rb
lib/faker/tv_shows/the_expanse.rb
# frozen_string_literal: true module Faker class TvShows class TheExpanse < Base flexible :the_expanse class << self ## # Produces a character from The Expanse. # # @return [String] # # @example # Faker::TvShows::TheExpanse.character #=> "Jim Holden" # # @faker.version 1.9.2 def character fetch('the_expanse.characters') end ## # Produces a quote from The Expanse. # # @return [String] # # @example # Faker::TvShows::TheExpanse.quote #=> "I am that guy." # # @faker.version 1.9.2 def quote fetch('the_expanse.quotes') end ## # Produces a location from The Expanse. # # @return [String] # # @example # Faker::TvShows::TheExpanse.location #=> "Ganymede" # # @faker.version 1.9.2 def location fetch('the_expanse.locations') end ## # Produces a ship from The Expanse. # # @return [String] # # @example # Faker::TvShows::TheExpanse.ship #=> "Nauvoo" # # @faker.version 1.9.2 def ship fetch('the_expanse.ships') end end end end end
ruby
MIT
a4d5e503edda970fc085e942018ee235622bfb11
2026-01-04T15:37:50.353881Z
false
faker-ruby/faker
https://github.com/faker-ruby/faker/blob/a4d5e503edda970fc085e942018ee235622bfb11/lib/faker/tv_shows/silicon_valley.rb
lib/faker/tv_shows/silicon_valley.rb
# frozen_string_literal: true module Faker class TvShows class SiliconValley < Base flexible :silicon_valley class << self ## # Produces a character from Silicon Valley. # # @return [String] # # @example # Faker::TvShows::SiliconValley.character #=> "Jian Yang" # # @faker.version 1.8.5 def character fetch('silicon_valley.characters') end ## # Produces a company from Silicon Valley. # # @return [String] # # @example # Faker::TvShows::SiliconValley.company #=> "Bachmanity" # # @faker.version 1.8.5 def company fetch('silicon_valley.companies') end ## # Produces a quote from Silicon Valley. # # @return [String] # # @example # Faker::TvShows::SiliconValley.quote # #=> "I don't want to live in a world where someone else is making the world a better place better than we are." # # @faker.version 1.8.5 def quote fetch('silicon_valley.quotes') end ## # Produces an app from Silicon Valley. # # @return [String] # # @example # Faker::TvShows::SiliconValley.app #=> "Nip Alert" # # @faker.version 1.8.5 def app fetch('silicon_valley.apps') end ## # Produces an invention from Silicon Valley. # # @return [String] # # @example # Faker::TvShows::SiliconValley.invention # #=> "Tres Comas Tequila" # # @faker.version 1.8.5 def invention fetch('silicon_valley.inventions') end ## # Produces a motto from Silicon Valley. # # @return [String] # # @example # Faker::TvShows::SiliconValley.motto # #=> "Our products are products, producing unrivaled results" # # @faker.version 1.8.5 def motto fetch('silicon_valley.mottos') end ## # Produces a URL from Silicon Valley. # # @return [String] # # @example # Faker::TvShows::SiliconValley.url #=> "http://www.piedpiper.com" # # @faker.version 1.8.5 def url fetch('silicon_valley.urls') end ## # Produces an email address from Silicon Valley. # # @return [String] # # @example # Faker::TvShows::SiliconValley.email #=> "richard@piedpiper.test" # # @faker.version 1.9.0 def email fetch('silicon_valley.email') end end end end end
ruby
MIT
a4d5e503edda970fc085e942018ee235622bfb11
2026-01-04T15:37:50.353881Z
false
faker-ruby/faker
https://github.com/faker-ruby/faker/blob/a4d5e503edda970fc085e942018ee235622bfb11/lib/faker/tv_shows/aqua_teen_hunger_force.rb
lib/faker/tv_shows/aqua_teen_hunger_force.rb
# frozen_string_literal: true module Faker class TvShows class AquaTeenHungerForce < Base flexible :aqua_teen_hunger_force class << self ## # Produces a character from Aqua Teen Hunger Force. # # @return [String] # # @example # Faker::TvShows::AquaTeenHungerForce.character #=> "Master Shake" # # @faker.version 1.8.5 def character fetch('aqua_teen_hunger_force.character') end ## # Produces a perl of great ATHF wisdom # # @return [String] # # @example # Faker::TvShows::AquaTeenHungerForce.quote #=> "Friendship ain't about trust. Friendship's about nunchucks." # # @faker.version 2.13.0 def quote fetch('aqua_teen_hunger_force.quote') end end end end end
ruby
MIT
a4d5e503edda970fc085e942018ee235622bfb11
2026-01-04T15:37:50.353881Z
false
faker-ruby/faker
https://github.com/faker-ruby/faker/blob/a4d5e503edda970fc085e942018ee235622bfb11/lib/faker/tv_shows/new_girl.rb
lib/faker/tv_shows/new_girl.rb
# frozen_string_literal: true module Faker class TvShows class NewGirl < Base flexible :new_girl class << self ## # Produces a character from New Girl. # # @return [String] # # @example # Faker::TvShows::NewGirl.character #=> "Jessica Day" # # @faker.version 1.9.0 def character fetch('new_girl.characters') end ## # Produces a quote from New Girl. # # @return [String] # # @example # Faker::TvShows::NewGirl.quote # #=> "Are you cooking a frittata in a sauce pan? What is this - prison?" # # @faker.version 1.9.0 def quote fetch('new_girl.quotes') end end end end end
ruby
MIT
a4d5e503edda970fc085e942018ee235622bfb11
2026-01-04T15:37:50.353881Z
false
faker-ruby/faker
https://github.com/faker-ruby/faker/blob/a4d5e503edda970fc085e942018ee235622bfb11/lib/faker/tv_shows/stargate.rb
lib/faker/tv_shows/stargate.rb
# frozen_string_literal: true module Faker class TvShows class Stargate < Base flexible :stargate class << self ## # Produces a character from Stargate. # # @return [String] # # @example # Faker::TvShows::Stargate.character #=> "Jack O'Neill" # # @faker.version 1.8.5 def character fetch('stargate.characters') end ## # Produces a planet from Stargate. # # @return [String] # # @example # Faker::TvShows::Stargate.planet #=> "Abydos" # # @faker.version 1.8.5 def planet fetch('stargate.planets') end ## # Produces a quote from Stargate. # # @return [String] # # @example # Faker::TvShows::Stargate.quote # #=> "General, request permission to beat the crap out of this man." # # @faker.version 1.8.5 def quote fetch('stargate.quotes') end end end end end
ruby
MIT
a4d5e503edda970fc085e942018ee235622bfb11
2026-01-04T15:37:50.353881Z
false
faker-ruby/faker
https://github.com/faker-ruby/faker/blob/a4d5e503edda970fc085e942018ee235622bfb11/lib/faker/tv_shows/dr_who.rb
lib/faker/tv_shows/dr_who.rb
# frozen_string_literal: true module Faker class TvShows class DrWho < Base flexible :dr_who class << self ## # Produces a character from Doctor Who. # # @return [String] # # @example # Faker::TvShows::DrWho.character #=> "Captain Jack Harkness" # # @faker.version 1.8.0 def character fetch('dr_who.character') end ## # Produces an iteration of The Doctor from Doctor Who. # # @return [String] # # @example # Faker::TvShows::DrWho.the_doctor #=> "Ninth Doctor" # # @faker.version 1.8.0 def the_doctor fetch('dr_who.the_doctors') end ## # Produces an actor from Doctor Who. # # @return [String] # # @example # Faker::TvShows::DrWho.actor #=> "Matt Smith" # # @faker.version 1.9.0 def actor fetch('dr_who.actors') end ## # Produces a catch phrase from Doctor Who. # # @return [String] # # @example # Faker::TvShows::DrWho.catch_phrase #=> "Fantastic!" # # @faker.version 1.8.0 def catch_phrase fetch('dr_who.catch_phrases') end ## # Produces a quote from Doctor Who. # # @return [String] # # @example # Faker::TvShows::DrWho.quote #=> "Lots of planets have a north!" # # @faker.version 1.8.0 def quote fetch('dr_who.quotes') end ## # Produces a villain from Doctor Who. # # @return [String] # # @example # Faker::TvShows::DrWho.villain #=> "The Master" # # @faker.version 2.13.0 def villain fetch('dr_who.villains') end ## # Produces a species from Doctor Who. # # @return [String] # # @example # Faker::TvShows::DrWho.specie #=> "Dalek" # # @faker.version 1.8.0 def specie fetch('dr_who.species') end end end end end
ruby
MIT
a4d5e503edda970fc085e942018ee235622bfb11
2026-01-04T15:37:50.353881Z
false
faker-ruby/faker
https://github.com/faker-ruby/faker/blob/a4d5e503edda970fc085e942018ee235622bfb11/lib/faker/tv_shows/how_i_met_your_mother.rb
lib/faker/tv_shows/how_i_met_your_mother.rb
# frozen_string_literal: true module Faker class TvShows class HowIMetYourMother < Base flexible :how_i_met_your_mother class << self ## # Produces a character from How I Met Your Mother. # # @return [String] # # @example # Faker::TvShows::HowIMetYourMother.character #=> "Barney Stinson" # # @faker.version 1.8.0 def character fetch('how_i_met_your_mother.character') end ## # Produces a catch phrase from How I Met Your Mother. # # @return [String] # # @example # Faker::TvShows::HowIMetYourMother.catch_phrase #=> "Legendary" # # @faker.version 1.8.0 def catch_phrase fetch('how_i_met_your_mother.catch_phrase') end ## # Produces a high five from How I Met Your Mother. # # @return [String] # # @example # Faker::TvShows::HowIMetYourMother.high_five #=> "Relapse Five" # # @faker.version 1.8.0 def high_five fetch('how_i_met_your_mother.high_five') end ## # Produces a quote from How I Met Your Mother. # # @return [String] # # @example # Faker::TvShows::HowIMetYourMother.quote # #=> "Whenever I'm sad, I stop being sad and be awesome instead." # # @faker.version 1.8.0 def quote fetch('how_i_met_your_mother.quote') end end end end end
ruby
MIT
a4d5e503edda970fc085e942018ee235622bfb11
2026-01-04T15:37:50.353881Z
false
faker-ruby/faker
https://github.com/faker-ruby/faker/blob/a4d5e503edda970fc085e942018ee235622bfb11/lib/faker/tv_shows/family_guy.rb
lib/faker/tv_shows/family_guy.rb
# frozen_string_literal: true module Faker class TvShows class FamilyGuy < Base flexible :family_guy class << self ## # Produces a character from Family Guy. # # @return [String] # # @example # Faker::TvShows::FamilyGuy.character #=> "Peter Griffin" # # @faker.version 1.8.0 def character fetch('family_guy.character') end ## # Produces a location from Family Guy. # # @return [String] # # @example # Faker::TvShows::FamilyGuy.location #=> "James Woods High" # # @faker.version 1.8.0 def location fetch('family_guy.location') end ## # Produces a quote from Family Guy. # # @return [String] # # @example # Faker::TvShows::FamilyGuy.quote # #=> "It's Peanut Butter Jelly Time." # # @faker.version 1.8.0 def quote fetch('family_guy.quote') end end end end end
ruby
MIT
a4d5e503edda970fc085e942018ee235622bfb11
2026-01-04T15:37:50.353881Z
false
faker-ruby/faker
https://github.com/faker-ruby/faker/blob/a4d5e503edda970fc085e942018ee235622bfb11/lib/faker/tv_shows/star_trek.rb
lib/faker/tv_shows/star_trek.rb
# frozen_string_literal: true module Faker class TvShows class StarTrek < Base flexible :star_trek class << self ## # Produces a character from Star Trek. # # @return [String] # # @example # Faker::TvShows::StarTrek.character #=> "Spock" # # @faker.version 1.8.0 def character fetch('star_trek.character') end ## # Produces a location from Star Trek. # # @return [String] # # @example # Faker::TvShows::StarTrek.location #=> "Cardassia" # # @faker.version 1.8.0 def location fetch('star_trek.location') end ## # Produces a species from Star Trek. # # @return [String] # # @example # Faker::TvShows::StarTrek.specie #=> "Ferengi" # # @faker.version 1.8.0 def specie fetch('star_trek.specie') end ## # Produces a villain from Star Trek. # # @return [String] # # @example # Faker::TvShows::StarTrek.villain #=> "Khan Noonien Singh" # # @faker.version 1.8.0 def villain fetch('star_trek.villain') end end end end end
ruby
MIT
a4d5e503edda970fc085e942018ee235622bfb11
2026-01-04T15:37:50.353881Z
false
faker-ruby/faker
https://github.com/faker-ruby/faker/blob/a4d5e503edda970fc085e942018ee235622bfb11/lib/faker/tv_shows/supernatural.rb
lib/faker/tv_shows/supernatural.rb
# frozen_string_literal: true module Faker class TvShows class Supernatural < Base class << self ## # Produces the name of a character from Supernatural. # # @return [String] # # @example # Faker::TvShows::Supernatural.character #=> "Dean Winchester" # # @faker.version next def character fetch('supernatural.character') end ## # Produces the name of a hunted creature. # # @return [String] # # @example # Faker::TvShows::Supernatural.creature #=> "Demon" # # @faker.version next def creature fetch('supernatural.creature') end ## # Produces the name of a weapon used by the hunters. # # @return [String] # # @example # Faker::TvShows::Supernatural.weapon #=> "Colt" # # @faker.version next def weapon fetch('supernatural.weapon') end end end end end
ruby
MIT
a4d5e503edda970fc085e942018ee235622bfb11
2026-01-04T15:37:50.353881Z
false
faker-ruby/faker
https://github.com/faker-ruby/faker/blob/a4d5e503edda970fc085e942018ee235622bfb11/lib/faker/tv_shows/south_park.rb
lib/faker/tv_shows/south_park.rb
# frozen_string_literal: true module Faker class TvShows class SouthPark < Base flexible :south_park class << self ## # Produces a character from South Park. # # @return [String] # # @example # Faker::TvShows::SouthPark.character #=> "Mr. Garrison" # # @faker.version 1.9.2 def character fetch('south_park.characters') end ## # Produces a quote from South Park. # # @return [String] # # @example # Faker::TvShows::SouthPark.quote # #=> "I'm just getting a little cancer Stan." # # @faker.version 1.9.2 def quote fetch('south_park.quotes') end ## # Produces an episode name from South Park. # # @return [String] # # @example # Faker::TvShows::SouthPark.episode_name # #=> "Make Love, Not Warcraft" # # @faker.version next def episode_name fetch('south_park.episodes') end end end end end
ruby
MIT
a4d5e503edda970fc085e942018ee235622bfb11
2026-01-04T15:37:50.353881Z
false
faker-ruby/faker
https://github.com/faker-ruby/faker/blob/a4d5e503edda970fc085e942018ee235622bfb11/lib/faker/tv_shows/hey_arnold.rb
lib/faker/tv_shows/hey_arnold.rb
# frozen_string_literal: true module Faker class TvShows class HeyArnold < Base flexible :hey_arnold class << self ## # Produces a character from Hey Arnold! # # @return [String] # # @example # Faker::TvShows::HeyArnold.character #=> "Arnold" # # @faker.version 1.8.0 def character fetch('hey_arnold.characters') end ## # Produces a location from Hey Arnold! # # @return [String] # # @example # Faker::TvShows::HeyArnold.location #=> "Big Bob's Beeper Emporium" # # @faker.version 1.8.0 def location fetch('hey_arnold.locations') end ## # Produces a quote from Hey Arnold! # # @return [String] # # @example # Faker::TvShows::HeyArnold.quote #=> "Stoop Kid's afraid to leave his stoop!" # # @faker.version 1.8.0 def quote fetch('hey_arnold.quotes') end end end end end
ruby
MIT
a4d5e503edda970fc085e942018ee235622bfb11
2026-01-04T15:37:50.353881Z
false
faker-ruby/faker
https://github.com/faker-ruby/faker/blob/a4d5e503edda970fc085e942018ee235622bfb11/lib/faker/tv_shows/spongebob.rb
lib/faker/tv_shows/spongebob.rb
# frozen_string_literal: true module Faker class TvShows class Spongebob < Base flexible :spongebob class << self ## # Produces a character from Spongebob. # # @return [String] # # @example # Faker::TvShows::Spongebob.character #=> "Patrick" # # @faker.version next def character fetch('spongebob.characters') end ## # Produces a quote from Spongebob. # # @return [String] # # @example # Faker::TvShows::Spongebob.quote #=> "I'm ready! I'm ready!" # # @faker.version next def quote fetch('spongebob.quotes') end ## # Produces an episode from Spongebob. # # @return [String] # # @example # Faker::TvShows::Spongebob.episode #=> "Reef Blower" # # @faker.version next def episode fetch('spongebob.episodes') end end end end end
ruby
MIT
a4d5e503edda970fc085e942018ee235622bfb11
2026-01-04T15:37:50.353881Z
false
faker-ruby/faker
https://github.com/faker-ruby/faker/blob/a4d5e503edda970fc085e942018ee235622bfb11/lib/faker/tv_shows/friends.rb
lib/faker/tv_shows/friends.rb
# frozen_string_literal: true module Faker class TvShows class Friends < Base flexible :friends class << self ## # Produces a character from Friends. # # @return [String] # # @example # Faker::TvShows::Friends.character #=> "Rachel Green" # # @faker.version 1.7.3 def character fetch('friends.characters') end ## # Produces a location from Friends. # # @return [String] # # @example # Faker::TvShows::Friends.location #=> "Central Perk" # # @faker.version 1.7.3 def location fetch('friends.locations') end ## # Produces a quote from Friends. # # @return [String] # # @example # Faker::TvShows::Friends.quote #=> "We were on a break!" # # @faker.version 1.7.3 def quote fetch('friends.quotes') end end end end end
ruby
MIT
a4d5e503edda970fc085e942018ee235622bfb11
2026-01-04T15:37:50.353881Z
false
faker-ruby/faker
https://github.com/faker-ruby/faker/blob/a4d5e503edda970fc085e942018ee235622bfb11/lib/faker/tv_shows/dumb_and_dumber.rb
lib/faker/tv_shows/dumb_and_dumber.rb
# frozen_string_literal: true module Faker class TvShows class DumbAndDumber < Base flexible :dumb_and_dumber class << self ## # Produces an actor from Dumb and Dumber. # # @return [String] # # @example # Faker::TvShows::DumbAndDumber.actor #=> "Jim Carrey" # # @faker.version 1.8.5 def actor fetch('dumb_and_dumber.actors') end ## # Produces a character from Dumb and Dumber. # # @return [String] # # @example # Faker::TvShows::DumbAndDumber.character #=> "Harry Dunne" # # @faker.version 1.8.5 def character fetch('dumb_and_dumber.characters') end ## # Produces a quote from Dumb and Dumber. # # @return [String] # # @example # Faker::TvShows::DumbAndDumber.quote # #=> "Why you going to the airport? Flying somewhere?" # # @faker.version 1.8.5 def quote fetch('dumb_and_dumber.quotes') end end end end end
ruby
MIT
a4d5e503edda970fc085e942018ee235622bfb11
2026-01-04T15:37:50.353881Z
false
faker-ruby/faker
https://github.com/faker-ruby/faker/blob/a4d5e503edda970fc085e942018ee235622bfb11/lib/faker/tv_shows/bojack_horseman.rb
lib/faker/tv_shows/bojack_horseman.rb
# frozen_string_literal: true module Faker class TvShows class BojackHorseman < Base flexible :bojack_horseman class << self ## # Produces a character from BoJack Horseman. # # @return [String] # # @example # Faker::TvShows::BojackHorseman.character #=> "BoJack Horseman" # # @faker.version 1.9.0 def character fetch('bojack_horseman.characters') end ## # Produces a tongue twister from BoJack Horseman. # # @return [String] # # @example # Faker::TvShows::BojackHorseman.tongue_twister #=> "Did you steal a meal from Neal McBeal the Navy Seal?" # # @faker.version 1.9.0 def tongue_twister fetch('bojack_horseman.tongue_twisters') end ## # Produces a quote from BoJack Horseman. # # @return [String] # # @example # Faker::TvShows::BojackHorseman.quote # #=> "Not understanding that you're a horrible person doesn't make you less of a horrible person." # # @faker.version 1.9.0 def quote fetch('bojack_horseman.quotes') end end end end end
ruby
MIT
a4d5e503edda970fc085e942018ee235622bfb11
2026-01-04T15:37:50.353881Z
false
faker-ruby/faker
https://github.com/faker-ruby/faker/blob/a4d5e503edda970fc085e942018ee235622bfb11/lib/faker/tv_shows/the_it_crowd.rb
lib/faker/tv_shows/the_it_crowd.rb
# frozen_string_literal: true module Faker class TvShows class TheITCrowd < Base flexible :the_it_crowd class << self ## # Produces an actor from The IT Crowd. # # @return [String] # # @example # Faker::TvShows::TheITCrowd.actor #=> "Chris O'Dowd" # # @faker.version 1.9.0 def actor fetch('the_it_crowd.actors') end ## # Produces a character from The IT Crowd. # # @return [String] # # @example # Faker::TvShows::TheITCrowd.character #=> "Roy Trenneman" # # @faker.version 1.9.0 def character fetch('the_it_crowd.characters') end ## # Produces an email from The IT Crowd. # # @return [String] # # @example # Faker::TvShows::TheITCrowd.email #=> "roy.trenneman@reynholm.test" # # @faker.version 1.9.0 def email fetch('the_it_crowd.emails') end ## # Produces a quote from The IT Crowd. # # @return [String] # # @example # Faker::TvShows::TheITCrowd.quote # #=> "Hello, IT. Have you tried turning it off and on again?" # # @faker.version 1.9.0 def quote fetch('the_it_crowd.quotes') end end end end end
ruby
MIT
a4d5e503edda970fc085e942018ee235622bfb11
2026-01-04T15:37:50.353881Z
false
faker-ruby/faker
https://github.com/faker-ruby/faker/blob/a4d5e503edda970fc085e942018ee235622bfb11/lib/faker/tv_shows/the_thick_of_it.rb
lib/faker/tv_shows/the_thick_of_it.rb
# frozen_string_literal: true module Faker class TvShows class TheThickOfIt < Base flexible :the_thick_of_it class << self ## # Produces a character from The Thick of It. # # @return [String] # # @example # Faker::TvShows::TheThickOfIt.character #=> "Nicola Murray" # # @faker.version 1.8.5 def character fetch('the_thick_of_it.characters') end ## # Produces a department from The Thick of It. # # @return [String] # # @example # Faker::TvShows::TheThickOfIt.department #=> "Shadow Cabinet" # # @faker.version 1.8.5 def department fetch('the_thick_of_it.departments') end ## # Produces a position from The Thick of It. # # @return [String] # # @example # Faker::TvShows::TheThickOfIt.position # #=> "Director of Communications" # # @faker.version 1.8.5 def position fetch('the_thick_of_it.positions') end end end end end
ruby
MIT
a4d5e503edda970fc085e942018ee235622bfb11
2026-01-04T15:37:50.353881Z
false
faker-ruby/faker
https://github.com/faker-ruby/faker/blob/a4d5e503edda970fc085e942018ee235622bfb11/lib/faker/tv_shows/venture_bros.rb
lib/faker/tv_shows/venture_bros.rb
# frozen_string_literal: true module Faker class TvShows class VentureBros < Base flexible :venture_bros class << self ## # Produces a character from The Venture Bros. # # @return [String] # # @example # Faker::TvShows::VentureBros.character #=> "Scaramantula" # # @faker.version 1.8.3 def character fetch('venture_bros.character') end ## # Produces an organization from The Venture Bros. # # @return [String] # # @example # Faker::TvShows::VentureBros.organization # #=> "Guild of Calamitous Intent" # # @faker.version 1.8.3 def organization fetch('venture_bros.organization') end ## # Produces a vehicle from The Venture Bros. # # @return [String] # # @example # Faker::TvShows::VentureBros.vehicle #=> "Monarchmobile" # # @faker.version 1.8.3 def vehicle fetch('venture_bros.vehicle') end ## # Produces a quote from The Venture Bros. # # @return [String] # # @example # Faker::TvShows::VentureBros.quote # #=> "Revenge, like gazpacho soup, is best served cold, precise, and merciless." # # @faker.version 1.8.3 def quote fetch('venture_bros.quote') end end end end end
ruby
MIT
a4d5e503edda970fc085e942018ee235622bfb11
2026-01-04T15:37:50.353881Z
false
faker-ruby/faker
https://github.com/faker-ruby/faker/blob/a4d5e503edda970fc085e942018ee235622bfb11/lib/faker/tv_shows/stranger_things.rb
lib/faker/tv_shows/stranger_things.rb
# frozen_string_literal: true module Faker class TvShows class StrangerThings < Base flexible :stranger_things class << self ## # Produces a character from Stranger Things. # # @return [String] # # @example # Faker::TvShows::StrangerThings.character #=> "six" # # @faker.version 1.9.0 def quote fetch('stranger_things.quote') end ## # Produces a quote from Stranger Things. # # @return [String] # # @example # Faker::TvShows::StrangerThings.quote # #=> "Friends don't lie." # # @faker.version 1.9.0 def character fetch('stranger_things.character') end end end end end
ruby
MIT
a4d5e503edda970fc085e942018ee235622bfb11
2026-01-04T15:37:50.353881Z
false
faker-ruby/faker
https://github.com/faker-ruby/faker/blob/a4d5e503edda970fc085e942018ee235622bfb11/lib/faker/tv_shows/futurama.rb
lib/faker/tv_shows/futurama.rb
# frozen_string_literal: true module Faker class TvShows class Futurama < Base flexible :futurama class << self ## # Produces a character from Futurama. # # @return [String] # # @example # Faker::TvShows::Futurama.character #=> "Amy Wong" # # @faker.version 2.13.0 def character fetch('futurama.characters') end ## # Produces a location from Futurama. # # @return [String] # # @example # Faker::TvShows::Futurama.location #=> "Wormulon" # # @faker.version 2.13.0 def location fetch('futurama.locations') end ## # Produces a quote from Futurama. # # @return [String] # # @example # Faker::TvShows::Futurama.quote # #=> "Ugh, it's like a party in my mouth & everyone's throwing up." # # @faker.version 2.13.0 def quote fetch('futurama.quotes') end ## # Produces a catchphrase from Hermes Conrad. # # @return [String] # # @example # Faker::TvShows::Futurama.hermes_catchphrase # #=> "Great foo of bar!" # # @faker.version 2.13.0 def hermes_catchphrase fetch('futurama.hermes_catchphrases') end end end end end
ruby
MIT
a4d5e503edda970fc085e942018ee235622bfb11
2026-01-04T15:37:50.353881Z
false
faker-ruby/faker
https://github.com/faker-ruby/faker/blob/a4d5e503edda970fc085e942018ee235622bfb11/lib/faker/tv_shows/the_office.rb
lib/faker/tv_shows/the_office.rb
# frozen_string_literal: true module Faker class TvShows class TheOffice < Base flexible :the_office class << self ## # Produces a character from The Office. # # @return [String] # # @example # Faker::TvShows::TheOffice.character #=> "Michael Scott" # # @faker.version next def character fetch('the_office.characters') end ## # Produces a quote from The Office. # # @return [String] # # @example # Faker::TvShows::TheOffice.quote #=> "Identity theft is not a joke, Jim! Millions of families suffer every year." # # @faker.version next def quote fetch('the_office.quotes') end end end end end
ruby
MIT
a4d5e503edda970fc085e942018ee235622bfb11
2026-01-04T15:37:50.353881Z
false
faker-ruby/faker
https://github.com/faker-ruby/faker/blob/a4d5e503edda970fc085e942018ee235622bfb11/lib/faker/tv_shows/final_space.rb
lib/faker/tv_shows/final_space.rb
# frozen_string_literal: true module Faker class TvShows class FinalSpace < Base flexible :final_space class << self ## # Produces a character from Final Space. # # @return [String] # # @example # Faker::TvShows::FinalSpace.character #=> "Gary Goodspeed" # # @faker.version next def character fetch('final_space.characters') end ## # Produces a vehicle from Final Space. # # @return [String] # # @example # Faker::TvShows::FinalSpace.vehicle #=> "Imperium Cruiser" # # @faker.version next def vehicle fetch('final_space.vehicles') end ## # Produces a quote from Final Space. # # @return [String] # # @example # Faker::TvShows::FinalSpace.quote # #=> "It's an alien on my face! It's an alien on my...It's a space alien!" # # @faker.version next def quote fetch('final_space.quotes') end end end end end
ruby
MIT
a4d5e503edda970fc085e942018ee235622bfb11
2026-01-04T15:37:50.353881Z
false
faker-ruby/faker
https://github.com/faker-ruby/faker/blob/a4d5e503edda970fc085e942018ee235622bfb11/lib/faker/tv_shows/the_fresh_prince_of_bel_air.rb
lib/faker/tv_shows/the_fresh_prince_of_bel_air.rb
# frozen_string_literal: true module Faker class TvShows class TheFreshPrinceOfBelAir < Base flexible :the_fresh_prince_of_bel_air class << self ## # Produces a character from The Fresh Prince of Bel-Air. # # @return [String] # # @example # Faker::TvShows::TheFreshPrinceOfBelAir.character #=> "Will Smith" # # @faker.version 1.8.3 def character fetch('the_fresh_prince_of_bel_air.characters') end ## # Produces a actor from The Fresh Prince of Bel-Air. # # @return [String] # # @example # Faker::TvShows::TheFreshPrinceOfBelAir.actor #=> "Quincy Jones" # # @faker.version next def actor fetch('the_fresh_prince_of_bel_air.actors') end ## # Produces a quote from The Fresh Prince of Bel-Air. # # @return [String] # # @example # Faker::TvShows::TheFreshPrinceOfBelAir.quote # #=> "Girl, you look so good, I would marry your brother just to get in your family." # # @faker.version 1.8.3 def quote fetch('the_fresh_prince_of_bel_air.quotes') end end end end end
ruby
MIT
a4d5e503edda970fc085e942018ee235622bfb11
2026-01-04T15:37:50.353881Z
false
faker-ruby/faker
https://github.com/faker-ruby/faker/blob/a4d5e503edda970fc085e942018ee235622bfb11/lib/faker/tv_shows/community.rb
lib/faker/tv_shows/community.rb
# frozen_string_literal: true module Faker class TvShows class Community < Base flexible :community class << self ## # Produces a character from Community. # # @return [String] # # @example # Faker::TvShows::Community.characters #=> "Jeff Winger" # # @faker.version 1.9.0 def characters fetch('community.characters') end ## # Produces a quote from Community. # # @return [String] # # @example # Faker::TvShows::Community.quotes # #=> "I fear a political career could shine a negative light on my drug dealing." # # @faker.version 1.9.0 def quotes fetch('community.quotes') end end end end end
ruby
MIT
a4d5e503edda970fc085e942018ee235622bfb11
2026-01-04T15:37:50.353881Z
false
faker-ruby/faker
https://github.com/faker-ruby/faker/blob/a4d5e503edda970fc085e942018ee235622bfb11/lib/faker/tv_shows/game_of_thrones.rb
lib/faker/tv_shows/game_of_thrones.rb
# frozen_string_literal: true module Faker class TvShows class GameOfThrones < Base flexible :game_of_thrones class << self ## # Produces a character from Game of Thrones. # # @return [String] # # @example # Faker::TvShows::GameOfThrones.character #=> "Tyrion Lannister" # # @faker.version 1.6.6 def character fetch('game_of_thrones.characters') end ## # Produces a house from Game of Thrones. # # @return [String] # # @example # Faker::TvShows::GameOfThrones.house #=> "Stark" # # @faker.version 1.6.6 def house fetch('game_of_thrones.houses') end ## # Produces a city from Game of Thrones. # # @return [String] # # @example # Faker::TvShows::GameOfThrones.city #=> "Lannisport" # # @faker.version 1.6.6 def city fetch('game_of_thrones.cities') end ## # Produces a quote from Game of Thrones. # # @return [String] # # @example # Faker::TvShows::GameOfThrones.quote # #=> "Never forget who you are. The rest of the world won't. Wear it like an armor and it can never be used against you." # # @faker.version 1.6.6 def quote fetch('game_of_thrones.quotes') end ## # Produces a dragon from Game of Thrones. # # @return [String] # # @example # Faker::TvShows::GameOfThrones.dragon #=> "Drogon" # # @faker.version 1.6.6 def dragon fetch('game_of_thrones.dragons') end end end end end
ruby
MIT
a4d5e503edda970fc085e942018ee235622bfb11
2026-01-04T15:37:50.353881Z
false
faker-ruby/faker
https://github.com/faker-ruby/faker/blob/a4d5e503edda970fc085e942018ee235622bfb11/lib/faker/movies/princess_bride.rb
lib/faker/movies/princess_bride.rb
# frozen_string_literal: true module Faker class Movies class PrincessBride < Base class << self ## # Produces a character from The Princess Bride. # # @return [String] # # @example # Faker::Movies::PrincessBride.character #=> "Dread Pirate Roberts" # # @faker.version 1.9.0 def character fetch('princess_bride.characters') end ## # Produces a quote from The Princess Bride. # # @return [String] # # @example # Faker::Movies::PrincessBride.quote # #=> "Hello. My name is Inigo Montoya. You killed my father. Prepare to die!" # # @faker.version 1.9.0 def quote fetch('princess_bride.quotes') end end end end end
ruby
MIT
a4d5e503edda970fc085e942018ee235622bfb11
2026-01-04T15:37:50.353881Z
false
faker-ruby/faker
https://github.com/faker-ruby/faker/blob/a4d5e503edda970fc085e942018ee235622bfb11/lib/faker/movies/v_for_vendetta.rb
lib/faker/movies/v_for_vendetta.rb
# frozen_string_literal: true module Faker class Movies class VForVendetta < Base class << self ## # Produces a character from V For Vendetta. # # @return [String] # # @example # Faker::Movies::VForVendetta.character #=> "V" # # @faker.version 1.8.5 def character fetch('v_for_vendetta.characters') end ## # Produces a speech from V For Vendetta. # # @return [String] # # @example # Faker::Movies::VForVendetta.speech # #=> "Remember, remember, the Fifth of November, the Gunpowder Treason and Plot. I know of no reason why the Gunpowder Treason should ever be forgot..." # # @faker.version 1.8.5 def speech fetch('v_for_vendetta.speeches') end ## # Produces a quote from V For Vendetta. # # @return [String] # # @example # Faker::Movies::VForVendetta.quote # #=> "People should not be afraid of their governments. Governments should be afraid of their people." # # @faker.version 1.8.5 def quote fetch('v_for_vendetta.quotes') end end end end end
ruby
MIT
a4d5e503edda970fc085e942018ee235622bfb11
2026-01-04T15:37:50.353881Z
false
faker-ruby/faker
https://github.com/faker-ruby/faker/blob/a4d5e503edda970fc085e942018ee235622bfb11/lib/faker/movies/how_to_train_your_dragon.rb
lib/faker/movies/how_to_train_your_dragon.rb
# frozen_string_literal: true module Faker class Movies class HowToTrainYourDragon < Base class << self ## # Produces a character from How To Train Your Dragon. # # @return [String] # # @example # Faker::Movies::HowToTrainYourDragon.character #=> "Hiccup" # # @faker.version next def character fetch('how_to_train_your_dragon.characters') end ## # Produces a location from How To Train Your Dragon. # # @return [String] # # @example # Faker::Movies::HowToTrainYourDragon.location #=> "Berk" # # @faker.version next def location fetch('how_to_train_your_dragon.locations') end ## # Produces a dragon from How To Train Your Dragon. # # @return [String] # # @example # Faker::Movies::HowToTrainYourDragon.dragons #=> "Toothless" # # @faker.version next def dragon fetch('how_to_train_your_dragon.dragons') end end end end end
ruby
MIT
a4d5e503edda970fc085e942018ee235622bfb11
2026-01-04T15:37:50.353881Z
false
faker-ruby/faker
https://github.com/faker-ruby/faker/blob/a4d5e503edda970fc085e942018ee235622bfb11/lib/faker/movies/ghostbusters.rb
lib/faker/movies/ghostbusters.rb
# frozen_string_literal: true module Faker class Movies class Ghostbusters < Base class << self ## # Produces an actor from Ghostbusters. # # @return [String] # # @example # Faker::Movies::Ghostbusters.actor #=> "Bill Murray" # # @faker.version 1.9.2 def actor fetch('ghostbusters.actors') end ## # Produces a character from Ghostbusters. # # @return [String] # # @example # Faker::Movies::Ghostbusters.character #=> "Dr. Egon Spengler" # # @faker.version 1.9.2 def character fetch('ghostbusters.characters') end ## # Produces a quote from Ghostbusters. # # @return [String] # # @example # Faker::Movies::Ghostbusters.quote # #=> "I tried to think of the most harmless thing. Something I loved from my childhood. Something that could never ever possibly destroy us. Mr. Stay Puft!" # # @faker.version 1.9.2 def quote fetch('ghostbusters.quotes') end end end end end
ruby
MIT
a4d5e503edda970fc085e942018ee235622bfb11
2026-01-04T15:37:50.353881Z
false
faker-ruby/faker
https://github.com/faker-ruby/faker/blob/a4d5e503edda970fc085e942018ee235622bfb11/lib/faker/movies/star_wars.rb
lib/faker/movies/star_wars.rb
# frozen_string_literal: true module Faker class Movies class StarWars < Base class << self ## # Produces a call squadron from Star Wars. # # @return [String] # # @example # Faker::Movies::StarWars.call_squadron #=> "Green" # # @faker.version 1.6.2 def call_squadron sample(call_squadrons) end ## # Produces a call sign from Star Wars. # # @return [String] # # @example # Faker::Movies::StarWars.call_sign #=> "Grey 5" # # @faker.version 1.6.2 def call_sign numerify(parse('star_wars.call_sign')) end ## # Produces a call number from Star Wars. # # @return [String] # # @example # Faker::Movies::StarWars.call_number #=> "Leader" # # @faker.version 1.6.2 def call_number sample(call_numbers) end ## # Produces a character from Star Wars. # # @return [String] # # @example # Faker::Movies::StarWars.character #=> "Anakin Skywalker" # # @faker.version 1.6.2 def character sample(characters) end ## # Produces a droid from Star Wars. # # @return [String] # # @example # Faker::Movies::StarWars.droid #=> "C-3PO" # # @faker.version 1.6.2 def droid sample(droids) end ## # Produces a planet from Star Wars. # # @return [String] # # @example # Faker::Movies::StarWars.planet #=> "Tatooine" # # @faker.version 1.6.2 def planet sample(planets) end ## # Produces a species from Star Wars. # # @return [String] # # @example # Faker::Movies::StarWars.specie #=> "Gungan" # # @faker.version 1.6.2 def specie sample(species) end ## # Produces a vehicle from Star Wars. # # @return [String] # # @example # Faker::Movies::StarWars.vehicle #=> "Sandcrawler" # # @faker.version 1.6.2 def vehicle sample(vehicles) end # Produces a wookiee sentence from Star Wars. # # @return [String] # # @example # Faker::Movies::StarWars.wookiee_sentence #=> "Yrroonn ru ooma roo ahuma ur roooarrgh hnn-rowr." # # @faker.version 1.6.2 def wookiee_sentence sentence = sample(wookiee_words).capitalize rand(0..10).times { sentence += " #{sample(wookiee_words)}" } sentence + sample(['.', '?', '!']) end ## # Produces a quote from Star Wars. # # @param character [String] The name of a character to derive a quote from. # @return [String] # # @example # Faker::Movies::StarWars.quote #=> "Aren't you a little short for a Stormtrooper?" # # @example # Faker::Movies::StarWars.quote(character: "leia_organa") # #=> "Aren't you a little short for a Stormtrooper?" # # @faker.version 1.6.2 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 ## # Generates numbers array # # @return [Array] # # @example # Faker::Movies::StarWars.call_numbers #=> ["Leader", "#"] # # @faker.version 1.6.2 def call_numbers fetch_all('star_wars.call_numbers') end ## # Returns squadrons array # # @return [Array] # # @example # Faker::Movies::StarWars.call_squadrons #=> ["Rogue", "Red", "Gray", "Green", "Blue", "Gold", "Black", "Yellow", "Phoenix"] # # @faker.version 1.6.2 def call_squadrons fetch_all('star_wars.call_squadrons') end ## # Returns all character names in movie # # @return [Array] # # @example # Faker::Movies::StarWars.characters # # @faker.version 1.6.2 def characters fetch_all('star_wars.characters') end ## # Returns droid list # # @return [Array] # # @example # Faker::Movies::StarWars.droids # # @faker.version 1.6.2 def droids fetch_all('star_wars.droids') end ## # Lists out all planet names # # @return [Array] # # @example # Faker::Movies::StarWars.planets # # @faker.version 1.6.2 def planets fetch_all('star_wars.planets') end ## # Returns name of all species # # @return [Array] # # @example # Faker::Movies::StarWars.species # # @faker.version 1.6.2 def species fetch_all('star_wars.species') end ## # Lists out all vehicles # # @return [Array] # # @example # Faker::Movies::StarWars.vehicles # # @faker.version 1.6.2 def vehicles fetch_all('star_wars.vehicles') end ## # All wookiee words # # @return [Array] # # @example # Faker::Movies::StarWars.wookiee_words # # @faker.version 1.6.2 def wookiee_words fetch_all('star_wars.wookiee_words') end alias wookie_sentence wookiee_sentence alias wookie_words wookiee_words end end end end
ruby
MIT
a4d5e503edda970fc085e942018ee235622bfb11
2026-01-04T15:37:50.353881Z
false
faker-ruby/faker
https://github.com/faker-ruby/faker/blob/a4d5e503edda970fc085e942018ee235622bfb11/lib/faker/movies/hitchhikers_guide_to_the_galaxy.rb
lib/faker/movies/hitchhikers_guide_to_the_galaxy.rb
# frozen_string_literal: true module Faker class Movies class HitchhikersGuideToTheGalaxy < Base class << self ## # Produces a character from The Hitchhiker's Guide to the Galaxy. # # @return [String] # # @example # Faker::Movies::HitchhikersGuideToTheGalaxy.character #=> "Marvin" # # @faker.version 1.8.0 def character fetch('hitchhikers_guide_to_the_galaxy.characters') end ## # Produces a location from The Hitchhiker's Guide to the Galaxy. # # @return [String] # # @example # Faker::Movies::HitchhikersGuideToTheGalaxy.location # #=> "Arthur Dent's house" # # @faker.version 1.8.0 def location fetch('hitchhikers_guide_to_the_galaxy.locations') end ## # Produces a Marvin quote from The Hitchhiker's Guide to the Galaxy. # # @return [String] # # @example # Faker::Movies::HitchhikersGuideToTheGalaxy.marvin_quote # #=> "Life? Don't talk to me about life." # # @faker.version 1.8.0 def marvin_quote fetch('hitchhikers_guide_to_the_galaxy.marvin_quote') end ## # Produces a planet from The Hitchhiker's Guide to the Galaxy. # # @return [String] # # @example # Faker::Movies::HitchhikersGuideToTheGalaxy.planet # #=> "Magrathea" # # @faker.version 1.8.0 def planet fetch('hitchhikers_guide_to_the_galaxy.planets') end ## # Produces a quote from The Hitchhiker's Guide to the Galaxy. # # @return [String] # # @example # 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." # # @faker.version 1.8.0 def quote fetch('hitchhikers_guide_to_the_galaxy.quotes') end ## # Produces a species from The Hitchhiker's Guide to the Galaxy. # # @return [String] # # @example # Faker::Movies::HitchhikersGuideToTheGalaxy.specie # #=> "Perfectly Normal Beast" # # @faker.version 1.8.0 def specie fetch('hitchhikers_guide_to_the_galaxy.species') end ## # Produces a starship from The Hitchhiker's Guide to the Galaxy. # # @return [String] # # @example # Faker::Movies::HitchhikersGuideToTheGalaxy.starship # #=> "Vogon Constructor Fleet" # # @faker.version 1.8.0 def starship fetch('hitchhikers_guide_to_the_galaxy.starships') end end end end end
ruby
MIT
a4d5e503edda970fc085e942018ee235622bfb11
2026-01-04T15:37:50.353881Z
false
faker-ruby/faker
https://github.com/faker-ruby/faker/blob/a4d5e503edda970fc085e942018ee235622bfb11/lib/faker/movies/avatar.rb
lib/faker/movies/avatar.rb
# frozen_string_literal: true module Faker class Movies class Avatar < Base class << self ## # Produces a character from Avatar. # # @return [String] # # @example # Faker::Movies::Avatar.character #=> "Jake Sully" # # @faker.version next def character fetch('avatar.characters') end ## # Produces a date from Avatar. # # @return [String] # # @example # Faker::Movies::Avatar.date #=> "December 15, 2022" # # @faker.version next def date fetch('avatar.dates') end ## # Produces a quote from Avatar. # # @return [String] # # @example # Faker::Movies::Avatar.quote # #=> "If it ain't raining, we ain't training." # # @faker.version next def quote fetch('avatar.quotes') end end end end end
ruby
MIT
a4d5e503edda970fc085e942018ee235622bfb11
2026-01-04T15:37:50.353881Z
false
faker-ruby/faker
https://github.com/faker-ruby/faker/blob/a4d5e503edda970fc085e942018ee235622bfb11/lib/faker/movies/departed.rb
lib/faker/movies/departed.rb
# frozen_string_literal: true module Faker class Movies class Departed < Base class << self ## # Produces an actor from The Departed. # # @return [String] # # @example # Faker::Movies::Departed.actor #=> "Matt Damon" # # @faker.version 2.13.0 def actor fetch('departed.actors') end ## # Produces a character from The Departed. # # @return [String] # # @example # Faker::Movies::Departed.character #=> "Frank Costello" # # @faker.version 2.13.0 def character fetch('departed.characters') end ## # Produces a quote from The Departed. # # @return [String] # # @example # Faker::Movies::Departed.quote # #=> "I'm the guy who does his job. You must be the other guy" # # @faker.version 2.13.0 def quote fetch('departed.quotes') end end end end end
ruby
MIT
a4d5e503edda970fc085e942018ee235622bfb11
2026-01-04T15:37:50.353881Z
false
faker-ruby/faker
https://github.com/faker-ruby/faker/blob/a4d5e503edda970fc085e942018ee235622bfb11/lib/faker/movies/movie.rb
lib/faker/movies/movie.rb
# frozen_string_literal: true module Faker class Movie < Base class << self ## # Produces a title from a movie. # # @return [String] # # @example # Faker::Movie.title #=> "The Lord of the Rings: The Two Towers" # # @faker.version 2.13.0 def title fetch('movie.title') end ## # Produces a quote from a movie. # # @return [String] # # @example # Faker::Movie.quote #=> "Bumble bee tuna" # # @faker.version 1.8.1 def quote fetch('movie.quote') end end end end
ruby
MIT
a4d5e503edda970fc085e942018ee235622bfb11
2026-01-04T15:37:50.353881Z
false
faker-ruby/faker
https://github.com/faker-ruby/faker/blob/a4d5e503edda970fc085e942018ee235622bfb11/lib/faker/movies/harry_potter.rb
lib/faker/movies/harry_potter.rb
# frozen_string_literal: true module Faker class Movies class HarryPotter < Base class << self ## # Produces a character from Harry Potter. # # @return [String] # # @example # Faker::Movies::HarryPotter.character #=> "Harry Potter" # # @faker.version 1.7.3 def character fetch('harry_potter.characters') end ## # Produces a location from Harry Potter. # # @return [String] # # @example # Faker::Movies::HarryPotter.location #=> "Hogwarts" # # @faker.version 1.7.3 def location fetch('harry_potter.locations') end ## # Produces a quote from Harry Potter. # # @return [String] # # @example # Faker::Movies::HarryPotter.quote #=> "I solemnly swear that I am up to good." # # @faker.version 1.7.3 def quote fetch('harry_potter.quotes') end ## # Produces a book from Harry Potter. # # @return [String] # # @example # Faker::Movies::HarryPotter.book #=> "Harry Potter and the Chamber of Secrets" # # @faker.version 1.7.3 def book fetch('harry_potter.books') end ## # Produces a house from Harry Potter. # # @return [String] # # @example # Faker::Movies::HarryPotter.house #=> "Gryffindor" # # @faker.version 1.7.3 def house fetch('harry_potter.houses') end ## # Produces a spell from Harry Potter. # # @return [String] # # @example # Faker::Movies::HarryPotter.spell #=> "Reparo" # # @faker.version 1.7.3 def spell fetch('harry_potter.spells') end end end end end
ruby
MIT
a4d5e503edda970fc085e942018ee235622bfb11
2026-01-04T15:37:50.353881Z
false
faker-ruby/faker
https://github.com/faker-ruby/faker/blob/a4d5e503edda970fc085e942018ee235622bfb11/lib/faker/movies/hobbit.rb
lib/faker/movies/hobbit.rb
# frozen_string_literal: true module Faker class Movies class Hobbit < Base class << self ## # Produces the name of a character from The Hobbit. # # @return [String] # # @example # Faker::Movies::Hobbit.character #=> "Gandalf the Grey" # # @faker.version 1.8.0 def character fetch('tolkien.hobbit.character') end ## # Produces the name of one of the 13 dwarves from the Company, or Gandalf or Bilbo. # # @return [String] # # @example # Faker::Movies::Hobbit.thorins_company #=> "Thorin Oakenshield" # # @faker.version 1.8.0 def thorins_company fetch('tolkien.hobbit.thorins_company') end ## # Produces a quote from The Hobbit. # # @return [String] # # @example # Faker::Movies::Hobbit.quote # #=> "Never laugh at live dragons, Bilbo you fool!" # # @faker.version 1.8.0 def quote fetch('tolkien.hobbit.quote') end ## # Produces the name of a location from The Hobbit. # # @return [String] # # @example # Faker::Movies::Hobbit.location #=> "The Shire" # # @faker.version 1.8.0 def location fetch('tolkien.hobbit.location') end end end end end
ruby
MIT
a4d5e503edda970fc085e942018ee235622bfb11
2026-01-04T15:37:50.353881Z
false
faker-ruby/faker
https://github.com/faker-ruby/faker/blob/a4d5e503edda970fc085e942018ee235622bfb11/lib/faker/movies/back_to_the_future.rb
lib/faker/movies/back_to_the_future.rb
# frozen_string_literal: true module Faker class Movies class BackToTheFuture < Base class << self ## # Produces a character from Back to the Future. # # @return [String] # # @example # Faker::Movies::BackToTheFuture.character #=> "Marty McFly" # # @faker.version 1.8.5 def character fetch('back_to_the_future.characters') end ## # Produces a date from Back to the Future. # # @return [String] # # @example # Faker::Movies::BackToTheFuture.date #=> "November 5, 1955" # # @faker.version 1.8.5 def date fetch('back_to_the_future.dates') end ## # Produces a quote from Back to the Future. # # @return [String] # # @example # Faker::Movies::BackToTheFuture.quote # #=> "Roads? Where we're going, we don't need roads." # # @faker.version 1.8.5 def quote fetch('back_to_the_future.quotes') end end end end end
ruby
MIT
a4d5e503edda970fc085e942018ee235622bfb11
2026-01-04T15:37:50.353881Z
false
faker-ruby/faker
https://github.com/faker-ruby/faker/blob/a4d5e503edda970fc085e942018ee235622bfb11/lib/faker/movies/hackers.rb
lib/faker/movies/hackers.rb
# frozen_string_literal: true module Faker class Movies class Hackers < Base class << self ## # Produces a real character name from Hackers. # # @return [String] # # @example # Faker::Movies::Hackers.character #=> "Dade Murphy" # # @faker.version next def character fetch('hackers.characters') end ## # Produces a character hacker "handle" from Hackers. # # @return [String] # # @example # Faker::Movies::Hackers.handle #=> "Zero Cool" # # @faker.version next def handle fetch('hackers.handles') end ## # Produces a quote from Hackers. # # @return [String] # # @example # Faker::Movies::Hackers.quote #=> "Hack the Planet!" # # @faker.version next def quote fetch('hackers.quotes') end end end end end
ruby
MIT
a4d5e503edda970fc085e942018ee235622bfb11
2026-01-04T15:37:50.353881Z
false
faker-ruby/faker
https://github.com/faker-ruby/faker/blob/a4d5e503edda970fc085e942018ee235622bfb11/lib/faker/movies/lebowski.rb
lib/faker/movies/lebowski.rb
# frozen_string_literal: true module Faker class Movies class Lebowski < Base class << self ## # Produces an actor from The Big Lebowski. # # @return [String] # # @example # Faker::Movies::Lebowski.actor #=> "John Goodman" # # @faker.version 1.8.8 def actor fetch('lebowski.actors') end ## # Produces a character from The Big Lebowski. # # @return [String] # # @example # Faker::Movies::Lebowski.character #=> "Jackie Treehorn" # # @faker.version 1.8.8 def character fetch('lebowski.characters') end ## # Produces a quote from The Big Lebowski. # # @return [String] # # @example # Faker::Movies::Lebowski.quote #=> "Forget it, Donny, you're out of your element!" # # @faker.version 1.8.8 def quote fetch('lebowski.quotes') end end end end end
ruby
MIT
a4d5e503edda970fc085e942018ee235622bfb11
2026-01-04T15:37:50.353881Z
false
faker-ruby/faker
https://github.com/faker-ruby/faker/blob/a4d5e503edda970fc085e942018ee235622bfb11/lib/faker/movies/lord_of_the_rings.rb
lib/faker/movies/lord_of_the_rings.rb
# frozen_string_literal: true module Faker class Movies class LordOfTheRings < Base class << self ## # Produces a character from Lord of the Rings. # # @return [String] # # @example # Faker::Movies::LordOfTheRings.character #=> "Legolas" # # @faker.version 1.7.0 def character fetch('tolkien.lord_of_the_rings.characters') end ## # Produces a location from Lord of the Rings. # # @return [String] # # @example # Faker::Movies::LordOfTheRings.location #=> "Helm's Deep" # # @faker.version 1.7.0 def location fetch('tolkien.lord_of_the_rings.locations') end ## # Produces a quote from Lord of the Rings. # # @return [String] # # @example # Faker::Movies::LordOfTheRings.quote # #=> "I wish the Ring had never come to me. I wish none of this had happened." # # @faker.version 1.9.0 def quote fetch('tolkien.lord_of_the_rings.quotes') end end end end end
ruby
MIT
a4d5e503edda970fc085e942018ee235622bfb11
2026-01-04T15:37:50.353881Z
false
faker-ruby/faker
https://github.com/faker-ruby/faker/blob/a4d5e503edda970fc085e942018ee235622bfb11/lib/faker/movies/tron.rb
lib/faker/movies/tron.rb
# frozen_string_literal: true module Faker class Movies class Tron < Base class << self ## # Produces a character from Tron. # # @return [String] # # @example # Faker::Movies::Tron.character #=> "Bit" # # @faker.version next def character sample(characters) end ## # Produces a game from Tron. # # @return [String] # # @example # Faker::Movies::Tron.game #=> "Space Paranoids" # # @faker.version next def game sample(games) end ## # Produces a location from Tron. # # @return [String] # # @example # Faker::Movies::Tron.location #=> "Flynn's Arcade" # # @faker.version next def location sample(locations) end ## # Produces a program from Tron. # # @return [String] # # @example # Faker::Movies::Tron.program #=> "Clu" # # @faker.version next def program sample(programs) end ## # Produces a quote from Tron. # # @param character [String] The name of a character to derive a quote from. # @return [String] # # @example # Faker::Movies::Tron.quote #=> "Greetings, Programs!" # # @example # Faker::Movies::Tron.quote(character: "mcp") # #=> "End of Line." # # @faker.version next def quote(character: nil) quoted_characters = translate('faker.tron.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.tron.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("tron.quotes.#{character}") end ## # Produces a tagline from Tron. # # @return [String] # # @example # Faker::Movies::Tron.tagline #=> "The Electronic Gladiator" # # @faker.version next def tagline sample(taglines) end ## # Produces a user from Tron. # # @return [String] # # @example # Faker::Movies::Tron.user #=> "Light Cycle" # # @faker.version next def user sample(users) end ## # Produces a vehicle from Tron. # # @return [String] # # @example # Faker::Movies::Tron.vehicle #=> "Light Cycle" # # @faker.version next def vehicle sample(vehicles) end def characters translate('faker.tron.characters').values.flatten end def games fetch_all('tron.games') end def locations fetch_all('tron.locations') end def programs fetch_all('tron.characters.programs') end def taglines fetch_all('tron.taglines') end def users fetch_all('tron.characters.users') end def vehicles fetch_all('tron.vehicles') end end end end end
ruby
MIT
a4d5e503edda970fc085e942018ee235622bfb11
2026-01-04T15:37:50.353881Z
false
faker-ruby/faker
https://github.com/faker-ruby/faker/blob/a4d5e503edda970fc085e942018ee235622bfb11/lib/faker/movies/the_room.rb
lib/faker/movies/the_room.rb
# frozen_string_literal: true module Faker class Movies class TheRoom < Base class << self ## # Produces an actor from The Room (2003). # # @return [String] # # @example # Faker::Movies::Room.actor #=> "Tommy Wiseau" # # @faker.version next def actor fetch('the_room.actors') end ## # Produces a character from The Room (2003). # # @return [String] # # @example # Faker::Movies::Room.character #=> "Johnny" # # @faker.version next def character fetch('the_room.characters') end ## # Produces a location from The Room (2003). # # @return [String] # # @example # Faker::Movies::Room.location #=> "Johnny's Apartment" # # @faker.version next def location fetch('the_room.locations') end ## ## # Produces a quote from The Room (2003). # # @return [String] # # @example # Faker::Movies::Room.quote # #=> "You're lying, I never hit you. You are tearing me apart, Lisa!" # # @faker.version next def quote fetch('the_room.quotes') end end end end end
ruby
MIT
a4d5e503edda970fc085e942018ee235622bfb11
2026-01-04T15:37:50.353881Z
false
faker-ruby/faker
https://github.com/faker-ruby/faker/blob/a4d5e503edda970fc085e942018ee235622bfb11/lib/faker/books/book.rb
lib/faker/books/book.rb
# frozen_string_literal: true module Faker class Book < Base flexible :book class << self ## # Produces a random book title # # @return [String] # # @example # Faker::Book.title #=> "The Odd Sister" # # @faker.version 1.9.3 def title fetch('book.title') end ## # Produces a random book author # # @return [String] # # @example # Faker::Book.author #=> "Alysha Olsen" # # @faker.version 1.9.3 def author parse('book.author') end ## # Produces a random book publisher # # @return [String] # # @example # Faker::Book.publisher #=> "Opus Reader" # # @faker.version 1.9.3 def publisher fetch('book.publisher') end ## # Produces a random genre # # @return [String] # # @example # Faker::Book.genre #=> "Mystery" # # @faker.version 1.9.3 def genre fetch('book.genre') end end end end
ruby
MIT
a4d5e503edda970fc085e942018ee235622bfb11
2026-01-04T15:37:50.353881Z
false
faker-ruby/faker
https://github.com/faker-ruby/faker/blob/a4d5e503edda970fc085e942018ee235622bfb11/lib/faker/books/the_kingkiller_chronicle.rb
lib/faker/books/the_kingkiller_chronicle.rb
# frozen_string_literal: true module Faker class Books class TheKingkillerChronicle < Base class << self ## # Produces the name of a The Kingkiller Chronicle book. # # @return [String] # # @example # Faker::Books::TheKingkillerChronicle.book #=> "The Name of the Wind" # # @faker.version next def book fetch('books.the_kingkiller_chronicle.books') end ## # Produces the name of a The Kingkiller Chronicle character. # # @return [String] # # @example # Faker::Books::TheKingkillerChronicle.character #=> "Kvothe" # # @faker.version next def character fetch('books.the_kingkiller_chronicle.characters') end ## # Produces the name of a The Kingkiller Chronicle creature. # # @return [String] # # @example # Faker::Books::TheKingkillerChronicle.creature #=> "Scrael" # # @faker.version next def creature fetch('books.the_kingkiller_chronicle.creatures') end ## # Produces the name of a The Kingkiller Chronicle location. # # @return [String] # # @example # Faker::Books::TheKingkillerChronicle.location #=> "Tarbean" # # @faker.version next def location fetch('books.the_kingkiller_chronicle.locations') end end end end end
ruby
MIT
a4d5e503edda970fc085e942018ee235622bfb11
2026-01-04T15:37:50.353881Z
false
faker-ruby/faker
https://github.com/faker-ruby/faker/blob/a4d5e503edda970fc085e942018ee235622bfb11/lib/faker/books/dune.rb
lib/faker/books/dune.rb
# frozen_string_literal: true module Faker class Books ## # A Faker module beyond your dreams, test data beyond your imagination. class Dune < Base class << self ## # Produces the name of a character from Dune # # @return [String] # # @example # Faker::Books::Dune.character #=> "Leto Atreides" # # @faker.version 1.9.3 def character fetch('dune.characters') end ## # @return [String] # # @example # Faker::Books::Dune.title #=> "Duke" # # @faker.version 1.9.3 def title fetch('dune.titles') end ## # Produces the name of a city from Dune # # @return [String] # # @example # Faker::Books::Dune.city #=> "Arrakeen" # # @faker.version next def city fetch('dune.cities') end ## # Produces the name of a planet from Dune # # @return [String] # # @example # Faker::Books::Dune.planet #=> "Caladan" # # @faker.version 1.9.3 def planet fetch('dune.planets') end ## # Produces a quote from Dune # # @param character [String] The name of the character that the quote should be from # # @return [String] # # @example # Faker::Books::Dune.quote # #=> "A dead man, surely, no longer requires that water." # @example # Faker::Books::Dune.quote(character: "baron_harkonnen") # #=> "He who controls the spice, controls the universe!" # # @faker.version 1.9.3 def quote(character: nil) quoted_characters = translate('faker.dune.quotes').keys if character.nil? character = sample(quoted_characters).to_s else character = character.to_s.downcase unless quoted_characters.include?(character.to_sym) raise ArgumentError, "Characters quoted can be left blank or #{quoted_characters.join(', ')}" end end fetch("dune.quotes.#{character}") end ## # Produces a saying from Dune # # @param source [String] # # @return [String] # # @example # Faker::Books::Dune.saying #=> "You do not beg the sun for mercy." # @example # Faker::Books::Dune.saying(source: "fremen") # #=> "May thy knife chip and shatter." # # @faker.version 1.9.3 def saying(source: nil) sourced_sayings = translate('faker.dune.sayings').keys if source.nil? source = sample(sourced_sayings).to_s else source = source.to_s.downcase unless sourced_sayings.include?(source.to_sym) raise ArgumentError, "Sources quoted in sayings can be left blank or #{sourced_sayings.join(', ')}" end end fetch("dune.sayings.#{source}") end end end end end
ruby
MIT
a4d5e503edda970fc085e942018ee235622bfb11
2026-01-04T15:37:50.353881Z
false
faker-ruby/faker
https://github.com/faker-ruby/faker/blob/a4d5e503edda970fc085e942018ee235622bfb11/lib/faker/books/lovecraft.rb
lib/faker/books/lovecraft.rb
# frozen_string_literal: true module Faker class Books class Lovecraft < Base class << self ## # Produces the name of a location # # @return [String] # # @example # Faker::Books::Lovecraft.location #=> "Kingsport" # # @faker.version 1.9.3 def location fetch('lovecraft.location') end ## # @param number [Integer] The number of times to repeat the chant # @return [String] # # @example # Faker::Books::Lovecraft.fhtagn # #=> "Ph'nglui mglw'nafh Cthulhu R'lyeh wgah'nagl fhtagn" # @example # Faker::Books::Lovecraft.fhtagn(number: 3) # #=> "Ph'nglui mglw'nafh Cthulhu R'lyeh wgah'nagl fht... # # @faker.version 1.9.3 def fhtagn(number: 1) Array.new(number) { fetch('lovecraft.fhtagn') }.join('. ') end ## # Produces the name of a deity # # @return [String] # # @example # Faker::Books::Lovecraft.deity #=> "Shub-Niggurath" # # @faker.version 1.9.3 def deity fetch('lovecraft.deity') end ## # Produces the name of a tome # # @return [String] # # @example # Faker::Books::Lovecraft.tome #=> "Book of Eibon" # # @faker.version 1.9.3 def tome fetch('lovecraft.tome') end ## # Produces a random sentence # # @param word_count [Integer] The number of words to have in the sentence # @param random_words_to_add [Integer] # @param open_compounds_allowed [Boolean] If true, generated sentence can contain words having additional spaces # # @return [String] # # @example # Faker::Books::Lovecraft.sentence # #=> "Furtive antiquarian squamous dank cat loathsome amorphous lurk." # @example # Faker::Books::Lovecraft.sentence(word_count: 3) # #=> "Daemoniac antediluvian fainted squamous comprehension gambrel nameless singular." # @example # Faker::Books::Lovecraft.sentence(word_count: 3, random_words_to_add: 1) # #=> "Amorphous indescribable tenebrous." # @example # Faker::Books::Lovecraft.sentence(word_count: 3, random_words_to_add: 0, open_compounds_allowed: true) # #=> "Effulgence unmentionable gambrel." # # @faker.version 1.9.3 def sentence(word_count: 4, random_words_to_add: 6, open_compounds_allowed: true) "#{words(number: word_count + rand(random_words_to_add.to_i).to_i, spaces_allowed: open_compounds_allowed).join(' ').capitalize}." end ## # Produces a random word # # @return [String] # # @example # Faker::Books::Lovecraft.word #=> "furtive" # # @faker.version 1.9.3 def word random_word = sample(translate('faker.lovecraft.words')) random_word =~ /\s/ ? word : random_word end ## # Produces a array of random words # # @param number [Integer] Number of words to generate # @param spaces_allowed [Boolean] If true, generated words can contain spaces # # @return [Array<String>] # # @example # Faker::Books::Lovecraft.words # #=> [ # # "manuscript", # # "abnormal", # # "singular", # # ] # @example # Faker::Books::Lovecraft.words(number: 2) # #=> [ # # "daemoniac", # # "cat", # # ] # @example # Faker::Books::Lovecraft.words(number: 2, spaces_allowed: 1) # #=> [ # # "lurk", # # "charnel", # # ] # # @faker.version 1.9.3 def words(number: 3, spaces_allowed: false) resolved_num = resolve(number) word_list = translate('faker.lovecraft.words') word_list *= ((resolved_num / word_list.length) + 1) words = sample(word_list, resolved_num) return words if spaces_allowed words.each_with_index { |w, i| words[i] = word if w =~ /\s/ } end ## # Produces a array of random sentences # # @param number [Integer] Number of sentences to generate # # @return [Array<String>] # # @example # Faker::Books::Lovecraft.sentences # #=> [ # # "Nameless loathsome decadent gambrel.", # # "Ululate swarthy immemorial cat madness gibbous unmentionable unnamable.", # # "Decadent antediluvian non-euclidean tentacles amorphous tenebrous.", # # ] # @example # Faker::Books::Lovecraft.sentences(number: 2) # #=> [ # # "Antediluvian amorphous unmentionable singular accursed squamous immemorial.", # # "Gambrel daemoniac gibbous stygian shunned ululate iridescence abnormal.", # # ] # # @faker.version 1.9.3 def sentences(number: 3) [].tap do |sentences| 1.upto(resolve(number)) do sentences << sentence(word_count: 3) end end end ## # Produces a random paragraph # # @param sentence_count [Integer] Number of sentences to generate # @param random_sentences_to_add [Integer] # # @return [String] # # @example # Faker::Books::Lovecraft.paragraph # #=> "Squamous nameless daemoniac fungus ululate. Cyclopean stygian decadent loathsome manuscript tenebrous. Foetid abnormal stench. Dank non-euclidean comprehension eldritch. Charnel singular shunned lurk effulgence fungus." # @example # Faker::Books::Lovecraft.paragraph(sentence_count: 2) # #=> "Decadent lurk tenebrous loathsome furtive spectral amorphous gibbous. Gambrel eldritch daemoniac cat madness comprehension stygian effulgence." # @example # Faker::Books::Lovecraft.paragraph(sentence_count: 1, random_sentences_to_add: 1) # #=> "Stench cyclopean fainted antiquarian nameless. Antiquarian ululate tenebrous non-euclidean effulgence." # # @faker.version 1.9.3 def paragraph(sentence_count: 3, random_sentences_to_add: 3) sentences(number: resolve(sentence_count) + rand(random_sentences_to_add.to_i).to_i).join(' ') end ## # Produces a array of random paragraphs # # @param number [Integer] Number of paragraphs to generate # # @return [Array<String>] # # @example # Faker::Books::Lovecraft.paragraphs # #=> [ # # "Noisome daemoniac gibbous abnormal antediluvian. Unutterable fung... # # "Non-euclidean immemorial indescribable accursed furtive. Dank unn... # # "Charnel antediluvian unnamable cat blasphemous comprehension tene... # # ] # @example # Faker::Books::Lovecraft.paragraphs(number: 2) # #=> [ # # "Hideous amorphous manuscript antediluvian non-euclidean cat eldri... # # "Tenebrous unnamable comprehension antediluvian lurk. Lurk spectra... # # ] # # @faker.version 1.9.3 def paragraphs(number: 3) [].tap do |paragraphs| 1.upto(resolve(number)) do paragraphs << paragraph(sentence_count: 3) end end end ## # @param characters [Integer] Number of characters to generate in the paragraph # # @return [String] # # @example # Faker::Books::Lovecraft.paragraph_by_chars # #=> "Truffaut stumptown trust fund 8-bit messenger bag portland. Meh kombucha selvage swag biodiesel. Lomo kinfolk jean shorts asymmetrical diy. Wayfarers portland twee stumptown. Wes anderson biodiesel retro 90's pabst. Diy echo 90's mixtape semiotics. Cornho." # @example # Faker::Books::Lovecraft.paragraph_by_chars(characters: 128) # #=> "Effulgence madness noisome. Fungus stygian mortal madness amorphous dank. Decadent noisome hideous effulgence. Tentacles charne." # # @faker.version 1.9.3 def paragraph_by_chars(characters: 256) paragraph = paragraph(sentence_count: 3) paragraph += " #{paragraph(sentence_count: 3)}" while paragraph.length < characters "#{paragraph[0...(characters - 1)]}." end end end end end
ruby
MIT
a4d5e503edda970fc085e942018ee235622bfb11
2026-01-04T15:37:50.353881Z
false
faker-ruby/faker
https://github.com/faker-ruby/faker/blob/a4d5e503edda970fc085e942018ee235622bfb11/lib/faker/books/culture_series.rb
lib/faker/books/culture_series.rb
# frozen_string_literal: true module Faker class Books class CultureSeries < Base flexible :culture_series class << self ## # @return [String] # # @example # Faker::Books::CultureSeries.book # #=> "The Player of Games" # # @faker.version 1.9.3 def book fetch('culture_series.books') end ## # @return [String] # # @example # Faker::Books::CultureSeries.culture_ship # #=> "Fate Amenable To Change" # # @faker.version 1.9.3 def culture_ship fetch('culture_series.culture_ships') end ## # @return [String] # # @example # Faker::Books::CultureSeries.culture_ship_class # #=> "General Systems Vehicle" # # @faker.version 1.9.3 def culture_ship_class fetch('culture_series.culture_ship_classes') end ## # @return [String] # # @example # Faker::Books::CultureSeries.culture_ship_class_abv # #=> "The Odd Sister" # # @faker.version 1.9.3 def culture_ship_class_abv fetch('culture_series.culture_ship_class_abvs') end ## # @return [String] # # @example # Faker::Books::CultureSeries.civ # #=> "Culture" # # @faker.version 1.9.3 def civ fetch('culture_series.civs') end ## # @return [String] # # @example # Faker::Books::CultureSeries.planet # #=> "Xinth" # # @faker.version 1.9.3 def planet fetch('culture_series.planets') end end end end end
ruby
MIT
a4d5e503edda970fc085e942018ee235622bfb11
2026-01-04T15:37:50.353881Z
false
varvet/pundit
https://github.com/varvet/pundit/blob/3488802b2f218ba26562e91186655297c95eb6da/spec/authorization_spec.rb
spec/authorization_spec.rb
# frozen_string_literal: true require "spec_helper" require "action_controller/metal/strong_parameters" describe Pundit::Authorization do def to_params(*args, **kwargs, &block) ActionController::Parameters.new(*args, **kwargs, &block) end let(:controller) { Controller.new(user, "update", to_params({})) } let(:user) { double("user") } let(:post) { Post.new(user) } let(:comment) { Comment.new } let(:article) { Article.new } let(:article_tag) { ArticleTag.new } let(:wiki) { Wiki.new } describe "#verify_authorized" do it "does nothing when authorized" do controller.authorize(post) controller.verify_authorized end it "raises an exception when not authorized" do expect { controller.verify_authorized }.to raise_error(Pundit::AuthorizationNotPerformedError) end end describe "#verify_policy_scoped" do it "does nothing when policy_scope is used" do controller.policy_scope(Post) controller.verify_policy_scoped end it "raises an exception when policy_scope is not used" do expect { controller.verify_policy_scoped }.to raise_error(Pundit::PolicyScopingNotPerformedError) end end describe "#pundit_policy_authorized?" do it "is true when authorized" do controller.authorize(post) expect(controller.pundit_policy_authorized?).to be true end it "is false when not authorized" do expect(controller.pundit_policy_authorized?).to be false end end describe "#pundit_policy_scoped?" do it "is true when policy_scope is used" do controller.policy_scope(Post) expect(controller.pundit_policy_scoped?).to be true end it "is false when policy scope is not used" do expect(controller.pundit_policy_scoped?).to be false end end describe "#authorize" do it "infers the policy name and authorizes based on it" do expect(controller.authorize(post)).to be_truthy end it "returns the record on successful authorization" do expect(controller.authorize(post)).to eq(post) end it "returns the record when passed record with namespace " do expect(controller.authorize([:project, comment], :update?)).to eq(comment) end it "returns the record when passed record with nested namespace " do expect(controller.authorize([:project, :admin, comment], :update?)).to eq(comment) end it "returns the policy name symbol when passed record with headless policy" do expect(controller.authorize(:publication, :create?)).to eq(:publication) end it "returns the class when passed record not a particular instance" do expect(controller.authorize(Post, :show?)).to eq(Post) end it "can be given a different permission to check" do expect(controller.authorize(post, :show?)).to be_truthy expect { controller.authorize(post, :destroy?) }.to raise_error(Pundit::NotAuthorizedError) end it "can be given a different policy class" do expect(controller.authorize(post, :create?, policy_class: PublicationPolicy)).to be_truthy end it "works with anonymous class policies" do expect(controller.authorize(article_tag, :show?)).to be_truthy expect { controller.authorize(article_tag, :destroy?) }.to raise_error(Pundit::NotAuthorizedError) end it "throws an exception when the permission check fails" do expect { controller.authorize(Post.new) }.to raise_error(Pundit::NotAuthorizedError) end it "throws an exception when a policy cannot be found" do expect { controller.authorize(Article) }.to raise_error(Pundit::NotDefinedError) end it "caches the policy" do expect(controller.policies[post]).to be_nil controller.authorize(post) expect(controller.policies[post]).not_to be_nil end it "raises an error when the given record is nil" do expect { controller.authorize(nil, :destroy?) }.to raise_error(Pundit::NotAuthorizedError) end it "raises an error with a invalid policy constructor" do expect { controller.authorize(wiki, :destroy?) }.to raise_error(Pundit::InvalidConstructorError) end end describe "#skip_authorization" do it "disables authorization verification" do controller.skip_authorization expect { controller.verify_authorized }.not_to raise_error end end describe "#skip_policy_scope" do it "disables policy scope verification" do controller.skip_policy_scope expect { controller.verify_policy_scoped }.not_to raise_error end end describe "#pundit_user" do it "returns the same thing as current_user" do expect(controller.pundit_user).to eq controller.current_user end end describe "#policy" do it "returns an instantiated policy" do policy = controller.policy(post) expect(policy.user).to eq user expect(policy.post).to eq post end it "throws an exception if the given policy can't be found" do expect { controller.policy(article) }.to raise_error(Pundit::NotDefinedError) end it "raises an error with a invalid policy constructor" do expect { controller.policy(wiki) }.to raise_error(Pundit::InvalidConstructorError) end it "allows policy to be injected" do new_policy = double controller.policies[post] = new_policy expect(controller.policy(post)).to eq new_policy end end describe "#policy_scope" do it "returns an instantiated policy scope" do expect(controller.policy_scope(Post)).to eq :published end it "allows policy scope class to be overridden" do expect(controller.policy_scope(Post, policy_scope_class: PublicationPolicy::Scope)).to eq :published end it "throws an exception if the given policy can't be found" do expect { controller.policy_scope(Article) }.to raise_error(Pundit::NotDefinedError) end it "raises an error with a invalid policy scope constructor" do expect { controller.policy_scope(Wiki) }.to raise_error(Pundit::InvalidConstructorError) end it "allows policy_scope to be injected" do new_scope = double controller.policy_scopes[Post] = new_scope expect(controller.policy_scope(Post)).to eq new_scope end end describe "#permitted_attributes" do it "checks policy for permitted attributes" do params = to_params( post: { title: "Hello", votes: 5, admin: true } ) action = "update" expect(Controller.new(user, action, params).permitted_attributes(post).to_h).to eq( "title" => "Hello", "votes" => 5 ) expect(Controller.new(double, action, params).permitted_attributes(post).to_h).to eq("votes" => 5) end it "checks policy for permitted attributes for record of a ActiveModel type" do customer_post = Customer::Post.new(user) params = to_params( customer_post: { title: "Hello", votes: 5, admin: true } ) action = "update" expect(Controller.new(user, action, params).permitted_attributes(customer_post).to_h).to eq( "title" => "Hello", "votes" => 5 ) expect(Controller.new(double, action, params).permitted_attributes(customer_post).to_h).to eq( "votes" => 5 ) end it "goes through the policy cache" do params = to_params(post: { title: "Hello" }) user = double post = Post.new(user) controller = Controller.new(user, "update", params) expect do expect(controller.permitted_attributes(post)).to be_truthy expect(controller.permitted_attributes(post)).to be_truthy end.to change { PostPolicy.instances }.by(1) end end describe "#permitted_attributes_for_action" do it "is checked if it is defined in the policy" do params = to_params( post: { title: "Hello", body: "blah", votes: 5, admin: true } ) action = "revise" expect(Controller.new(user, action, params).permitted_attributes(post).to_h).to eq("body" => "blah") end it "can be explicitly set" do params = to_params( post: { title: "Hello", body: "blah", votes: 5, admin: true } ) action = "update" expect(Controller.new(user, action, params).permitted_attributes(post, :revise).to_h).to eq("body" => "blah") end end describe "#pundit_reset!" do it "allows authorize to react to a user change" do expect(controller.authorize(post)).to be_truthy controller.current_user = double controller.pundit_reset! expect { controller.authorize(post) }.to raise_error(Pundit::NotAuthorizedError) end it "allows policy to react to a user change" do expect(controller.policy(DummyCurrentUser).user).to be user new_user = double("new user") controller.current_user = new_user controller.pundit_reset! expect(controller.policy(DummyCurrentUser).user).to be new_user end it "allows policy scope to react to a user change" do expect(controller.policy_scope(DummyCurrentUser)).to be user new_user = double("new user") controller.current_user = new_user controller.pundit_reset! expect(controller.policy_scope(DummyCurrentUser)).to be new_user end it "resets the pundit context" do expect(controller.pundit.user).to be(user) new_user = double controller.current_user = new_user expect { controller.pundit_reset! }.to change { controller.pundit.user }.from(user).to(new_user) end it "clears pundit_policy_authorized? flag" do expect(controller.pundit_policy_authorized?).to be false controller.skip_authorization expect(controller.pundit_policy_authorized?).to be true controller.pundit_reset! expect(controller.pundit_policy_authorized?).to be false end it "clears pundit_policy_scoped? flag" do expect(controller.pundit_policy_scoped?).to be false controller.skip_policy_scope expect(controller.pundit_policy_scoped?).to be true controller.pundit_reset! expect(controller.pundit_policy_scoped?).to be false end end end
ruby
MIT
3488802b2f218ba26562e91186655297c95eb6da
2026-01-04T15:38:58.048292Z
false
varvet/pundit
https://github.com/varvet/pundit/blob/3488802b2f218ba26562e91186655297c95eb6da/spec/policy_finder_spec.rb
spec/policy_finder_spec.rb
# frozen_string_literal: true require "spec_helper" RSpec.describe Pundit::PolicyFinder do let(:user) { double } let(:post) { Post.new(user) } let(:comment) { CommentFourFiveSix.new } let(:article) { Article.new } describe "SUFFIX" do specify { expect(described_class::SUFFIX).to eq "Policy" } specify { expect(Pundit::SUFFIX).to eq(described_class::SUFFIX) } end describe "#scope" do subject { described_class.new(post) } it "returns a policy scope" do expect(subject.scope).to eq PostPolicy::Scope end context "policy is nil" do it "returns nil" do allow(subject).to receive(:policy).and_return nil expect(subject.scope).to eq nil end end end describe "#policy" do context "with an instance" do it "returns the associated policy" do object = described_class.new(post) expect(object.policy).to eq PostPolicy end end context "with an array of symbols" do it "returns the associated namespaced policy" do object = described_class.new(%i[project post]) expect(object.policy).to eq Project::PostPolicy end end context "with an array of a symbol and an instance" do it "returns the associated namespaced policy" do object = described_class.new([:project, post]) expect(object.policy).to eq Project::PostPolicy end end context "with an array of a symbol and a class with a specified policy class" do it "returns the associated namespaced policy" do object = described_class.new([:project, Customer::Post]) expect(object.policy).to eq Project::PostPolicy end end context "with an array of a symbol and a class with a specified model name" do it "returns the associated namespaced policy" do object = described_class.new([:project, CommentsRelation]) expect(object.policy).to eq Project::CommentPolicy end end context "with a class" do it "returns the associated policy" do object = described_class.new(Post) expect(object.policy).to eq PostPolicy end end context "with a class which has a specified policy class" do it "returns the associated policy" do object = described_class.new(Customer::Post) expect(object.policy).to eq PostPolicy end end context "with an instance which has a specified policy class" do it "returns the associated policy" do object = described_class.new(Customer::Post.new(user)) expect(object.policy).to eq PostPolicy end end context "with a class which has a specified model name" do it "returns the associated policy" do object = described_class.new(CommentsRelation) expect(object.policy).to eq CommentPolicy end end context "with an instance which has a specified policy class" do it "returns the associated policy" do object = described_class.new(CommentsRelation.new) expect(object.policy).to eq CommentPolicy end end context "with nil" do it "returns a NilClassPolicy" do object = described_class.new(nil) expect(object.policy).to eq NilClassPolicy end end context "with a class that doesn't have an associated policy" do it "returns nil" do object = described_class.new(Foo) expect(object.policy).to eq nil end end end describe "#scope!" do context "@object is nil" do subject { described_class.new(nil) } it "returns the NilClass policy's scope class" do expect(subject.scope!).to eq NilClassPolicy::Scope end end context "@object is defined" do subject { described_class.new(post) } it "returns the scope" do expect(subject.scope!).to eq PostPolicy::Scope end end end describe "#param_key" do context "object responds to model_name" do subject { described_class.new(comment) } it "returns the param_key" do expect(subject.object).to respond_to(:model_name) expect(subject.param_key).to eq "comment_four_five_six" end end context "object is a class" do subject { described_class.new(Article) } it "returns the param_key" do expect(subject.object).not_to respond_to(:model_name) expect(subject.object).to be_a Class expect(subject.param_key).to eq "article" end end context "object is an instance of a class" do subject { described_class.new(article) } it "returns the param_key" do expect(subject.object).not_to respond_to(:model_name) expect(subject.object).not_to be_a Class expect(subject.object).to be_an_instance_of Article expect(subject.param_key).to eq "article" end end context "object is an array" do subject { described_class.new([:project, article]) } it "returns the param_key for the last element of the array" do expect(subject.object).not_to respond_to(:model_name) expect(subject.object).not_to be_a Class expect(subject.object).to be_an_instance_of Array expect(subject.param_key).to eq "article" end end end end
ruby
MIT
3488802b2f218ba26562e91186655297c95eb6da
2026-01-04T15:38:58.048292Z
false
varvet/pundit
https://github.com/varvet/pundit/blob/3488802b2f218ba26562e91186655297c95eb6da/spec/simple_cov_check_action_formatter.rb
spec/simple_cov_check_action_formatter.rb
# frozen_string_literal: true require "simplecov" require "json" class SimpleCovCheckActionFormatter SourceFile = Data.define(:source_file) do def covered_strength = source_file.covered_strength def covered_percent = source_file.covered_percent def to_json(*args) { filename: source_file.filename, covered_percent: covered_percent.nan? ? 0.0 : covered_percent, coverage: source_file.coverage_data, covered_strength: covered_strength.nan? ? 0.0 : covered_strength, covered_lines: source_file.covered_lines.count, lines_of_code: source_file.lines_of_code }.to_json(*args) end end Result = Data.define(:result) do def included?(source_file) = result.filenames.include?(source_file.filename) def files result.files.filter_map do |source_file| next unless result.filenames.include? source_file.filename SourceFile.new(source_file) end end def to_json(*args) # rubocop:disable Metrics/AbcSize { timestamp: result.created_at.to_i, command_name: result.command_name, files: files, metrics: { covered_percent: result.covered_percent, covered_strength: result.covered_strength.nan? ? 0.0 : result.covered_strength, covered_lines: result.covered_lines, total_lines: result.total_lines } }.to_json(*args) end end FormatterWithOptions = Data.define(:formatter) do def new = formatter end class << self def with_options(...) FormatterWithOptions.new(new(...)) end end def initialize(output_filename: "coverage.json", output_directory: SimpleCov.coverage_path) @output_filename = output_filename @output_directory = output_directory end attr_reader :output_filename, :output_directory def output_filepath = File.join(output_directory, output_filename) def format(result_data) result = Result.new(result_data) json = JSON.generate(result) File.write(output_filepath, json) puts output_message(result_data) json end def output_message(result) "Coverage report generated for #{result.command_name} to #{output_filepath}. #{result.covered_lines} / #{result.total_lines} LOC (#{result.covered_percent.round(2)}%) covered." # rubocop:disable Layout/LineLength end end
ruby
MIT
3488802b2f218ba26562e91186655297c95eb6da
2026-01-04T15:38:58.048292Z
false
varvet/pundit
https://github.com/varvet/pundit/blob/3488802b2f218ba26562e91186655297c95eb6da/spec/generators_spec.rb
spec/generators_spec.rb
# frozen_string_literal: true require "spec_helper" require "tmpdir" require "rails/generators" require "generators/pundit/install/install_generator" require "generators/pundit/policy/policy_generator" RSpec.describe "generators" do before(:all) do @tmpdir = Dir.mktmpdir Dir.chdir(@tmpdir) do Pundit::Generators::InstallGenerator.new([], { quiet: true }).invoke_all Pundit::Generators::PolicyGenerator.new(%w[Widget], { quiet: true }).invoke_all require "./app/policies/application_policy" require "./app/policies/widget_policy" end end after(:all) do FileUtils.remove_entry(@tmpdir) end describe "WidgetPolicy", type: :policy do permissions :index?, :show?, :create?, :new?, :update?, :edit?, :destroy? do it "has safe defaults" do expect(WidgetPolicy).not_to permit(double("User"), double("Widget")) end end describe "WidgetPolicy::Scope" do describe "#resolve" do it "raises a descriptive error" do scope = WidgetPolicy::Scope.new(double("User"), double("User.all")) expect { scope.resolve }.to raise_error(NoMethodError, /WidgetPolicy::Scope/) end end end end end
ruby
MIT
3488802b2f218ba26562e91186655297c95eb6da
2026-01-04T15:38:58.048292Z
false
varvet/pundit
https://github.com/varvet/pundit/blob/3488802b2f218ba26562e91186655297c95eb6da/spec/pundit_spec.rb
spec/pundit_spec.rb
# frozen_string_literal: true require "spec_helper" RSpec.describe Pundit do let(:user) { double } let(:post) { Post.new(user) } let(:customer_post) { Customer::Post.new(user) } let(:post_four_five_six) { PostFourFiveSix.new(user) } let(:comment) { Comment.new } let(:comment_four_five_six) { CommentFourFiveSix.new } let(:article) { Article.new } let(:artificial_blog) { ArtificialBlog.new } let(:article_tag) { ArticleTag.new } let(:comments_relation) { CommentsRelation.new(empty: false) } let(:empty_comments_relation) { CommentsRelation.new(empty: true) } let(:tag_four_five_six) { ProjectOneTwoThree::TagFourFiveSix.new(user) } let(:avatar_four_five_six) { ProjectOneTwoThree::AvatarFourFiveSix.new } let(:wiki) { Wiki.new } describe ".authorize" do it "infers the policy and authorizes based on it" do expect(Pundit.authorize(user, post, :update?)).to be_truthy end it "returns the record on successful authorization" do expect(Pundit.authorize(user, post, :update?)).to eq(post) end it "returns the record when passed record with namespace " do expect(Pundit.authorize(user, [:project, comment], :update?)).to eq(comment) end it "returns the record when passed record with nested namespace " do expect(Pundit.authorize(user, [:project, :admin, comment], :update?)).to eq(comment) end it "returns the policy name symbol when passed record with headless policy" do expect(Pundit.authorize(user, :publication, :create?)).to eq(:publication) end it "returns the class when passed record not a particular instance" do expect(Pundit.authorize(user, Post, :show?)).to eq(Post) end it "works with anonymous class policies" do expect(Pundit.authorize(user, article_tag, :show?)).to be_truthy expect { Pundit.authorize(user, article_tag, :destroy?) }.to raise_error(Pundit::NotAuthorizedError) end it "raises an error with the policy, query and record" do # rubocop:disable Style/MultilineBlockChain expect do Pundit.authorize(user, post, :destroy?) end.to raise_error(Pundit::NotAuthorizedError, "not allowed to PostPolicy#destroy? this Post") do |error| expect(error.query).to eq :destroy? expect(error.record).to eq post expect(error.policy).to have_attributes( user: user, record: post ) expect(error.policy).to be_a(PostPolicy) end # rubocop:enable Style/MultilineBlockChain end it "raises an error with the policy, query and record when the record is namespaced" do # rubocop:disable Style/MultilineBlockChain expect do Pundit.authorize(user, [:project, :admin, comment], :destroy?) end.to raise_error(Pundit::NotAuthorizedError, "not allowed to Project::Admin::CommentPolicy#destroy? this Comment") do |error| expect(error.query).to eq :destroy? expect(error.record).to eq comment expect(error.policy).to have_attributes( user: user, record: comment ) expect(error.policy).to be_a(Project::Admin::CommentPolicy) end # rubocop:enable Style/MultilineBlockChain end it "raises an error with the policy, query and the class name when a Class is given" do # rubocop:disable Style/MultilineBlockChain expect do Pundit.authorize(user, Post, :destroy?) end.to raise_error(Pundit::NotAuthorizedError, "not allowed to PostPolicy#destroy? Post") do |error| expect(error.query).to eq :destroy? expect(error.record).to eq Post expect(error.policy).to have_attributes( user: user, record: Post ) expect(error.policy).to be_a(PostPolicy) end # rubocop:enable Style/MultilineBlockChain end it "raises an error with a invalid policy constructor" do expect do Pundit.authorize(user, wiki, :update?) end.to raise_error(Pundit::InvalidConstructorError, "Invalid #<WikiPolicy> constructor is called") end context "when passed a policy class" do it "uses the passed policy class" do expect(Pundit.authorize(user, post, :create?, policy_class: PublicationPolicy)).to be_truthy end # This is documenting past behaviour. it "doesn't cache the policy class" do cache = {} expect do Pundit.authorize(user, post, :create?, policy_class: PublicationPolicy, cache: cache) Pundit.authorize(user, post, :create?, policy_class: PublicationPolicy, cache: cache) end.to change { PublicationPolicy.instances }.by(2) end end context "when passed a policy class while simultaenously passing a namespace" do it "uses the passed policy class" do expect(PublicationPolicy).to receive(:new).with(user, comment).and_call_original expect(Pundit.authorize(user, [:project, comment], :create?, policy_class: PublicationPolicy)).to be_truthy end end context "when passed an explicit cache" do it "uses the hash assignment interface on the cache" do custom_cache = CustomCache.new Pundit.authorize(user, post, :update?, cache: custom_cache) expect(custom_cache.to_h).to match({ post => kind_of(PostPolicy) }) end end end describe ".policy_scope" do it "returns an instantiated policy scope given a plain model class" do expect(Pundit.policy_scope(user, Post)).to eq :published end it "returns an instantiated policy scope given an active model class" do expect(Pundit.policy_scope(user, Comment)).to eq CommentScope.new(Comment) end it "returns an instantiated policy scope given an active record relation" do expect(Pundit.policy_scope(user, comments_relation)).to eq CommentScope.new(comments_relation) end it "returns an instantiated policy scope given an empty active record relation" do expect(Pundit.policy_scope(user, empty_comments_relation)).to eq CommentScope.new(empty_comments_relation) end it "returns an instantiated policy scope given an array of a symbol and plain model class" do expect(Pundit.policy_scope(user, [:project, Post])).to eq :read end it "returns an instantiated policy scope given an array of a symbol and active model class" do expect(Pundit.policy_scope(user, [:project, Comment])).to eq Comment end it "returns nil if the given policy scope can't be found" do expect(Pundit.policy_scope(user, Article)).to be_nil end it "raises an exception if nil object given" do expect { Pundit.policy_scope(user, nil) }.to raise_error(Pundit::NotDefinedError) end it "raises an error with a invalid policy scope constructor" do expect do Pundit.policy_scope(user, Wiki) end.to raise_error(Pundit::InvalidConstructorError, "Invalid #<WikiPolicy::Scope> constructor is called") end it "raises an original error with a policy scope that contains error" do expect do Pundit.policy_scope(user, DefaultScopeContainsError) end.to raise_error(RuntimeError, "This is an arbitrary error that should bubble up") end end describe ".policy_scope!" do it "returns an instantiated policy scope given a plain model class" do expect(Pundit.policy_scope!(user, Post)).to eq :published end it "returns an instantiated policy scope given an active model class" do expect(Pundit.policy_scope!(user, Comment)).to eq CommentScope.new(Comment) end it "throws an exception if the given policy scope can't be found" do expect { Pundit.policy_scope!(user, Article) }.to raise_error(Pundit::NotDefinedError) end it "throws an exception if the given policy scope can't be found" do expect { Pundit.policy_scope!(user, ArticleTag) }.to raise_error(Pundit::NotDefinedError) end it "throws an exception if the given policy scope is nil" do expect do Pundit.policy_scope!(user, nil) end.to raise_error(Pundit::NotDefinedError, "Cannot scope NilClass") end it "returns an instantiated policy scope given an array of a symbol and plain model class" do expect(Pundit.policy_scope!(user, [:project, Post])).to eq :read end it "returns an instantiated policy scope given an array of a symbol and active model class" do expect(Pundit.policy_scope!(user, [:project, Comment])).to eq Comment end it "raises an error with a invalid policy scope constructor" do expect do Pundit.policy_scope(user, Wiki) end.to raise_error(Pundit::InvalidConstructorError, "Invalid #<WikiPolicy::Scope> constructor is called") end end describe ".policy" do it "returns an instantiated policy given a plain model instance" do policy = Pundit.policy(user, post) expect(policy.user).to eq user expect(policy.post).to eq post end it "returns an instantiated policy given an active model instance" do policy = Pundit.policy(user, comment) expect(policy.user).to eq user expect(policy.comment).to eq comment end it "returns an instantiated policy given a plain model class" do policy = Pundit.policy(user, Post) expect(policy.user).to eq user expect(policy.post).to eq Post end it "returns an instantiated policy given an active model class" do policy = Pundit.policy(user, Comment) expect(policy.user).to eq user expect(policy.comment).to eq Comment end it "returns an instantiated policy given a symbol" do policy = Pundit.policy(user, :criteria) expect(policy.class).to eq CriteriaPolicy expect(policy.user).to eq user expect(policy.criteria).to eq :criteria end it "returns an instantiated policy given an array of symbols" do policy = Pundit.policy(user, %i[project criteria]) expect(policy.class).to eq Project::CriteriaPolicy expect(policy.user).to eq user expect(policy.criteria).to eq :criteria end it "returns an instantiated policy given an array of a symbol and plain model instance" do policy = Pundit.policy(user, [:project, post]) expect(policy.class).to eq Project::PostPolicy expect(policy.user).to eq user expect(policy.post).to eq post end it "returns an instantiated policy given an array of a symbol and a model instance with policy_class override" do policy = Pundit.policy(user, [:project, customer_post]) expect(policy.class).to eq Project::PostPolicy expect(policy.user).to eq user expect(policy.post).to eq customer_post end it "returns an instantiated policy given an array of a symbol and an active model instance" do policy = Pundit.policy(user, [:project, comment]) expect(policy.class).to eq Project::CommentPolicy expect(policy.user).to eq user expect(policy.comment).to eq comment end it "returns an instantiated policy given an array of a symbol and a plain model class" do policy = Pundit.policy(user, [:project, Post]) expect(policy.class).to eq Project::PostPolicy expect(policy.user).to eq user expect(policy.post).to eq Post end it "raises an error with a invalid policy constructor" do expect do Pundit.policy(user, Wiki) end.to raise_error(Pundit::InvalidConstructorError, "Invalid #<WikiPolicy> constructor is called") end it "returns an instantiated policy given an array of a symbol and an active model class" do policy = Pundit.policy(user, [:project, Comment]) expect(policy.class).to eq Project::CommentPolicy expect(policy.user).to eq user expect(policy.comment).to eq Comment end it "returns an instantiated policy given an array of a symbol and a class with policy_class override" do policy = Pundit.policy(user, [:project, Customer::Post]) expect(policy.class).to eq Project::PostPolicy expect(policy.user).to eq user expect(policy.post).to eq Customer::Post end it "returns correct policy class for an array of a multi-word symbols" do policy = Pundit.policy(user, %i[project_one_two_three criteria_four_five_six]) expect(policy.class).to eq ProjectOneTwoThree::CriteriaFourFiveSixPolicy end it "returns correct policy class for an array of a multi-word symbol and a multi-word plain model instance" do policy = Pundit.policy(user, [:project_one_two_three, post_four_five_six]) expect(policy.class).to eq ProjectOneTwoThree::PostFourFiveSixPolicy end it "returns correct policy class for an array of a multi-word symbol and a multi-word active model instance" do policy = Pundit.policy(user, [:project_one_two_three, comment_four_five_six]) expect(policy.class).to eq ProjectOneTwoThree::CommentFourFiveSixPolicy end it "returns correct policy class for an array of a multi-word symbol and a multi-word plain model class" do policy = Pundit.policy(user, [:project_one_two_three, PostFourFiveSix]) expect(policy.class).to eq ProjectOneTwoThree::PostFourFiveSixPolicy end it "returns correct policy class for an array of a multi-word symbol and a multi-word active model class" do policy = Pundit.policy(user, [:project_one_two_three, CommentFourFiveSix]) expect(policy.class).to eq ProjectOneTwoThree::CommentFourFiveSixPolicy end it "returns correct policy class for a multi-word scoped plain model class" do policy = Pundit.policy(user, ProjectOneTwoThree::TagFourFiveSix) expect(policy.class).to eq ProjectOneTwoThree::TagFourFiveSixPolicy end it "returns correct policy class for a multi-word scoped plain model instance" do policy = Pundit.policy(user, tag_four_five_six) expect(policy.class).to eq ProjectOneTwoThree::TagFourFiveSixPolicy end it "returns correct policy class for a multi-word scoped active model class" do policy = Pundit.policy(user, ProjectOneTwoThree::AvatarFourFiveSix) expect(policy.class).to eq ProjectOneTwoThree::AvatarFourFiveSixPolicy end it "returns correct policy class for a multi-word scoped active model instance" do policy = Pundit.policy(user, avatar_four_five_six) expect(policy.class).to eq ProjectOneTwoThree::AvatarFourFiveSixPolicy end it "returns nil if the given policy can't be found" do expect(Pundit.policy(user, article)).to be_nil expect(Pundit.policy(user, Article)).to be_nil end it "returns the specified NilClassPolicy for nil" do expect(Pundit.policy(user, nil)).to be_a NilClassPolicy end describe "with .policy_class set on the model" do it "returns an instantiated policy given a plain model instance" do policy = Pundit.policy(user, artificial_blog) expect(policy.user).to eq user expect(policy.blog).to eq artificial_blog end it "returns an instantiated policy given a plain model class" do policy = Pundit.policy(user, ArtificialBlog) expect(policy.user).to eq user expect(policy.blog).to eq ArtificialBlog end it "returns an instantiated policy given a plain model instance providing an anonymous class" do policy = Pundit.policy(user, article_tag) expect(policy.user).to eq user expect(policy.tag).to eq article_tag end it "returns an instantiated policy given a plain model class providing an anonymous class" do policy = Pundit.policy(user, ArticleTag) expect(policy.user).to eq user expect(policy.tag).to eq ArticleTag end end end describe ".policy!" do it "returns an instantiated policy given a plain model instance" do policy = Pundit.policy!(user, post) expect(policy.user).to eq user expect(policy.post).to eq post end it "returns an instantiated policy given an active model instance" do policy = Pundit.policy!(user, comment) expect(policy.user).to eq user expect(policy.comment).to eq comment end it "returns an instantiated policy given a plain model class" do policy = Pundit.policy!(user, Post) expect(policy.user).to eq user expect(policy.post).to eq Post end it "returns an instantiated policy given an active model class" do policy = Pundit.policy!(user, Comment) expect(policy.user).to eq user expect(policy.comment).to eq Comment end it "returns an instantiated policy given a symbol" do policy = Pundit.policy!(user, :criteria) expect(policy.class).to eq CriteriaPolicy expect(policy.user).to eq user expect(policy.criteria).to eq :criteria end it "returns an instantiated policy given an array of symbols" do policy = Pundit.policy!(user, %i[project criteria]) expect(policy.class).to eq Project::CriteriaPolicy expect(policy.user).to eq user expect(policy.criteria).to eq :criteria end it "throws an exception if the given policy can't be found" do expect { Pundit.policy!(user, article) }.to raise_error(Pundit::NotDefinedError) expect { Pundit.policy!(user, Article) }.to raise_error(Pundit::NotDefinedError) end it "returns the specified NilClassPolicy for nil" do expect(Pundit.policy!(user, nil)).to be_a NilClassPolicy end it "raises an error with a invalid policy constructor" do expect do Pundit.policy(user, Wiki) end.to raise_error(Pundit::InvalidConstructorError, "Invalid #<WikiPolicy> constructor is called") end end describe ".included" do it "includes Authorization module" do klass = Class.new expect do klass.include Pundit end.to output.to_stderr expect(klass).to include Pundit::Authorization end it "warns about deprecation" do klass = Class.new expect do klass.include Pundit end.to output(a_string_starting_with("'include Pundit' is deprecated")).to_stderr end end describe "Pundit::NotAuthorizedError" do it "can be initialized with a string as message" do error = Pundit::NotAuthorizedError.new("must be logged in") expect(error.message).to eq "must be logged in" end end end
ruby
MIT
3488802b2f218ba26562e91186655297c95eb6da
2026-01-04T15:38:58.048292Z
false
varvet/pundit
https://github.com/varvet/pundit/blob/3488802b2f218ba26562e91186655297c95eb6da/spec/spec_helper.rb
spec/spec_helper.rb
# frozen_string_literal: true if ENV["COVERAGE"] require "simplecov" require "simplecov_json_formatter" require_relative "simple_cov_check_action_formatter" SimpleCov.formatters = SimpleCov::Formatter::MultiFormatter.new([ SimpleCov::Formatter::HTMLFormatter, SimpleCov::Formatter::JSONFormatter, SimpleCovCheckActionFormatter.with_options( output_filename: "simplecov-check-action.json" ) ]) SimpleCov.start do add_filter "/spec/" enable_coverage :branch primary_coverage :branch end end # @see https://github.com/rails/rails/issues/54260 require "logger" if RUBY_ENGINE == "jruby" && RUBY_ENGINE_VERSION.start_with?("9.3") require "pundit" require "pundit/rspec" require "active_model/naming" # Load all supporting files: models, policies, etc. require "zeitwerk" loader = Zeitwerk::Loader.new loader.push_dir(File.expand_path("support/models", __dir__)) loader.push_dir(File.expand_path("support/policies", __dir__)) loader.push_dir(File.expand_path("support/lib", __dir__)) loader.setup loader.eager_load
ruby
MIT
3488802b2f218ba26562e91186655297c95eb6da
2026-01-04T15:38:58.048292Z
false
varvet/pundit
https://github.com/varvet/pundit/blob/3488802b2f218ba26562e91186655297c95eb6da/spec/rspec_dsl_spec.rb
spec/rspec_dsl_spec.rb
# frozen_string_literal: true require "spec_helper" RSpec.describe "Pundit RSpec DSL" do include Pundit::RSpec::PolicyExampleGroup let(:fake_rspec) do double = class_double(RSpec::ExampleGroups) double.extend(::Pundit::RSpec::DSL) double end let(:block) { proc { "block content" } } let(:user) { double } let(:other_user) { double } let(:post) { Post.new(user) } let(:policy) { PostPolicy } it "calls describe with the correct metadata and without :focus" do expected_metadata = { permissions: %i[item1 item2], caller: instance_of(Array) } expect(fake_rspec).to receive(:describe).with("item1 and item2", match(expected_metadata)) do |&block| expect(block.call).to eq("block content") end fake_rspec.permissions(:item1, :item2, &block) end it "calls describe with the correct metadata and with :focus" do expected_metadata = { permissions: %i[item1 item2], caller: instance_of(Array), focus: true } expect(fake_rspec).to receive(:describe).with("item1 and item2", match(expected_metadata)) do |&block| expect(block.call).to eq("block content") end fake_rspec.permissions(:item1, :item2, :focus, &block) end describe "#permit" do context "when not appropriately wrapped in permissions" do it "raises a descriptive error" do expect do expect(policy).to permit(user, post) end.to raise_error(KeyError, <<~MSG.strip) No permissions in example metadata, did you forget to wrap with `permissions :show?, ...`? MSG end end permissions :edit?, :update? do it "succeeds when action is permitted" do expect(policy).to permit(user, post) end context "when it fails" do it "fails with a descriptive error message" do expect do expect(policy).to permit(other_user, post) end.to raise_error(RSpec::Expectations::ExpectationNotMetError, <<~MSG.strip) Expected PostPolicy to grant edit? and update? on Post but edit? and update? were not granted MSG end end context "when negated" do it "succeeds when action is not permitted" do expect(policy).not_to permit(other_user, post) end context "when it fails" do it "fails with a descriptive error message" do expect do expect(policy).not_to permit(user, post) end.to raise_error(RSpec::Expectations::ExpectationNotMetError, <<~MSG.strip) Expected PostPolicy not to grant edit? and update? on Post but edit? and update? were granted MSG end end end end end end
ruby
MIT
3488802b2f218ba26562e91186655297c95eb6da
2026-01-04T15:38:58.048292Z
false
varvet/pundit
https://github.com/varvet/pundit/blob/3488802b2f218ba26562e91186655297c95eb6da/spec/support/policies/criteria_policy.rb
spec/support/policies/criteria_policy.rb
# frozen_string_literal: true class CriteriaPolicy < BasePolicy alias criteria record end
ruby
MIT
3488802b2f218ba26562e91186655297c95eb6da
2026-01-04T15:38:58.048292Z
false
varvet/pundit
https://github.com/varvet/pundit/blob/3488802b2f218ba26562e91186655297c95eb6da/spec/support/policies/dummy_current_user_policy.rb
spec/support/policies/dummy_current_user_policy.rb
# frozen_string_literal: true class DummyCurrentUserPolicy < BasePolicy class Scope < BasePolicy::BaseScope def resolve user end end end
ruby
MIT
3488802b2f218ba26562e91186655297c95eb6da
2026-01-04T15:38:58.048292Z
false
varvet/pundit
https://github.com/varvet/pundit/blob/3488802b2f218ba26562e91186655297c95eb6da/spec/support/policies/denier_policy.rb
spec/support/policies/denier_policy.rb
# frozen_string_literal: true class DenierPolicy < BasePolicy def update? false end end
ruby
MIT
3488802b2f218ba26562e91186655297c95eb6da
2026-01-04T15:38:58.048292Z
false
varvet/pundit
https://github.com/varvet/pundit/blob/3488802b2f218ba26562e91186655297c95eb6da/spec/support/policies/nil_class_policy.rb
spec/support/policies/nil_class_policy.rb
# frozen_string_literal: true class NilClassPolicy < BasePolicy class Scope def initialize(*) raise Pundit::NotDefinedError, "Cannot scope NilClass" end end def show? false end def destroy? false end end
ruby
MIT
3488802b2f218ba26562e91186655297c95eb6da
2026-01-04T15:38:58.048292Z
false
varvet/pundit
https://github.com/varvet/pundit/blob/3488802b2f218ba26562e91186655297c95eb6da/spec/support/policies/comment_policy.rb
spec/support/policies/comment_policy.rb
# frozen_string_literal: true class CommentPolicy < BasePolicy class Scope < BaseScope def resolve CommentScope.new(scope) end end alias comment record end
ruby
MIT
3488802b2f218ba26562e91186655297c95eb6da
2026-01-04T15:38:58.048292Z
false
varvet/pundit
https://github.com/varvet/pundit/blob/3488802b2f218ba26562e91186655297c95eb6da/spec/support/policies/post_policy.rb
spec/support/policies/post_policy.rb
# frozen_string_literal: true class PostPolicy < BasePolicy class Scope < BaseScope def resolve scope.published end end alias post record def update? post.user == user end alias edit? update? def destroy? false end def show? true end def permitted_attributes if post.user == user %i[title votes] else [:votes] end end def permitted_attributes_for_revise [:body] end end
ruby
MIT
3488802b2f218ba26562e91186655297c95eb6da
2026-01-04T15:38:58.048292Z
false
varvet/pundit
https://github.com/varvet/pundit/blob/3488802b2f218ba26562e91186655297c95eb6da/spec/support/policies/wiki_policy.rb
spec/support/policies/wiki_policy.rb
# frozen_string_literal: true class WikiPolicy class Scope # deliberate typo method def initalize; end end end
ruby
MIT
3488802b2f218ba26562e91186655297c95eb6da
2026-01-04T15:38:58.048292Z
false
varvet/pundit
https://github.com/varvet/pundit/blob/3488802b2f218ba26562e91186655297c95eb6da/spec/support/policies/base_policy.rb
spec/support/policies/base_policy.rb
# frozen_string_literal: true class BasePolicy prepend InstanceTracking class BaseScope prepend InstanceTracking def initialize(user, scope) @user = user @scope = scope end attr_reader :user, :scope end def initialize(user, record) @user = user @record = record end attr_reader :user, :record end
ruby
MIT
3488802b2f218ba26562e91186655297c95eb6da
2026-01-04T15:38:58.048292Z
false
varvet/pundit
https://github.com/varvet/pundit/blob/3488802b2f218ba26562e91186655297c95eb6da/spec/support/policies/publication_policy.rb
spec/support/policies/publication_policy.rb
# frozen_string_literal: true class PublicationPolicy < BasePolicy class Scope < BaseScope def resolve scope.published end end def create? true end end
ruby
MIT
3488802b2f218ba26562e91186655297c95eb6da
2026-01-04T15:38:58.048292Z
false
varvet/pundit
https://github.com/varvet/pundit/blob/3488802b2f218ba26562e91186655297c95eb6da/spec/support/policies/article_tag_other_name_policy.rb
spec/support/policies/article_tag_other_name_policy.rb
# frozen_string_literal: true class ArticleTagOtherNamePolicy < BasePolicy def show? true end def destroy? false end alias tag record end
ruby
MIT
3488802b2f218ba26562e91186655297c95eb6da
2026-01-04T15:38:58.048292Z
false
varvet/pundit
https://github.com/varvet/pundit/blob/3488802b2f218ba26562e91186655297c95eb6da/spec/support/policies/blog_policy.rb
spec/support/policies/blog_policy.rb
# frozen_string_literal: true class BlogPolicy < BasePolicy alias blog record end
ruby
MIT
3488802b2f218ba26562e91186655297c95eb6da
2026-01-04T15:38:58.048292Z
false
varvet/pundit
https://github.com/varvet/pundit/blob/3488802b2f218ba26562e91186655297c95eb6da/spec/support/policies/default_scope_contains_error_policy.rb
spec/support/policies/default_scope_contains_error_policy.rb
# frozen_string_literal: true class DefaultScopeContainsErrorPolicy < BasePolicy class Scope < BaseScope def resolve # deliberate wrong usage of the method raise "This is an arbitrary error that should bubble up" end end end
ruby
MIT
3488802b2f218ba26562e91186655297c95eb6da
2026-01-04T15:38:58.048292Z
false
varvet/pundit
https://github.com/varvet/pundit/blob/3488802b2f218ba26562e91186655297c95eb6da/spec/support/policies/project_one_two_three/tag_four_five_six_policy.rb
spec/support/policies/project_one_two_three/tag_four_five_six_policy.rb
# frozen_string_literal: true module ProjectOneTwoThree class TagFourFiveSixPolicy < BasePolicy end end
ruby
MIT
3488802b2f218ba26562e91186655297c95eb6da
2026-01-04T15:38:58.048292Z
false
varvet/pundit
https://github.com/varvet/pundit/blob/3488802b2f218ba26562e91186655297c95eb6da/spec/support/policies/project_one_two_three/avatar_four_five_six_policy.rb
spec/support/policies/project_one_two_three/avatar_four_five_six_policy.rb
# frozen_string_literal: true module ProjectOneTwoThree class AvatarFourFiveSixPolicy < BasePolicy end end
ruby
MIT
3488802b2f218ba26562e91186655297c95eb6da
2026-01-04T15:38:58.048292Z
false
varvet/pundit
https://github.com/varvet/pundit/blob/3488802b2f218ba26562e91186655297c95eb6da/spec/support/policies/project_one_two_three/comment_four_five_six_policy.rb
spec/support/policies/project_one_two_three/comment_four_five_six_policy.rb
# frozen_string_literal: true module ProjectOneTwoThree class CommentFourFiveSixPolicy < BasePolicy end end
ruby
MIT
3488802b2f218ba26562e91186655297c95eb6da
2026-01-04T15:38:58.048292Z
false
varvet/pundit
https://github.com/varvet/pundit/blob/3488802b2f218ba26562e91186655297c95eb6da/spec/support/policies/project_one_two_three/criteria_four_five_six_policy.rb
spec/support/policies/project_one_two_three/criteria_four_five_six_policy.rb
# frozen_string_literal: true module ProjectOneTwoThree class CriteriaFourFiveSixPolicy < BasePolicy end end
ruby
MIT
3488802b2f218ba26562e91186655297c95eb6da
2026-01-04T15:38:58.048292Z
false
varvet/pundit
https://github.com/varvet/pundit/blob/3488802b2f218ba26562e91186655297c95eb6da/spec/support/policies/project_one_two_three/post_four_five_six_policy.rb
spec/support/policies/project_one_two_three/post_four_five_six_policy.rb
# frozen_string_literal: true module ProjectOneTwoThree class PostFourFiveSixPolicy < BasePolicy end end
ruby
MIT
3488802b2f218ba26562e91186655297c95eb6da
2026-01-04T15:38:58.048292Z
false
varvet/pundit
https://github.com/varvet/pundit/blob/3488802b2f218ba26562e91186655297c95eb6da/spec/support/policies/project/criteria_policy.rb
spec/support/policies/project/criteria_policy.rb
# frozen_string_literal: true module Project class CriteriaPolicy < BasePolicy alias criteria record end end
ruby
MIT
3488802b2f218ba26562e91186655297c95eb6da
2026-01-04T15:38:58.048292Z
false
varvet/pundit
https://github.com/varvet/pundit/blob/3488802b2f218ba26562e91186655297c95eb6da/spec/support/policies/project/comment_policy.rb
spec/support/policies/project/comment_policy.rb
# frozen_string_literal: true module Project class CommentPolicy < BasePolicy class Scope < BaseScope def resolve scope end end def update? true end alias comment record end end
ruby
MIT
3488802b2f218ba26562e91186655297c95eb6da
2026-01-04T15:38:58.048292Z
false
varvet/pundit
https://github.com/varvet/pundit/blob/3488802b2f218ba26562e91186655297c95eb6da/spec/support/policies/project/post_policy.rb
spec/support/policies/project/post_policy.rb
# frozen_string_literal: true module Project class PostPolicy < BasePolicy class Scope < BaseScope def resolve scope.read end end alias post record end end
ruby
MIT
3488802b2f218ba26562e91186655297c95eb6da
2026-01-04T15:38:58.048292Z
false
varvet/pundit
https://github.com/varvet/pundit/blob/3488802b2f218ba26562e91186655297c95eb6da/spec/support/policies/project/admin/comment_policy.rb
spec/support/policies/project/admin/comment_policy.rb
# frozen_string_literal: true module Project module Admin class CommentPolicy < BasePolicy def update? true end def destroy? false end end end end
ruby
MIT
3488802b2f218ba26562e91186655297c95eb6da
2026-01-04T15:38:58.048292Z
false
varvet/pundit
https://github.com/varvet/pundit/blob/3488802b2f218ba26562e91186655297c95eb6da/spec/support/models/dummy_current_user.rb
spec/support/models/dummy_current_user.rb
# frozen_string_literal: true class DummyCurrentUser def update? user end end
ruby
MIT
3488802b2f218ba26562e91186655297c95eb6da
2026-01-04T15:38:58.048292Z
false
varvet/pundit
https://github.com/varvet/pundit/blob/3488802b2f218ba26562e91186655297c95eb6da/spec/support/models/comment_four_five_six.rb
spec/support/models/comment_four_five_six.rb
# frozen_string_literal: true class CommentFourFiveSix extend ActiveModel::Naming end
ruby
MIT
3488802b2f218ba26562e91186655297c95eb6da
2026-01-04T15:38:58.048292Z
false
varvet/pundit
https://github.com/varvet/pundit/blob/3488802b2f218ba26562e91186655297c95eb6da/spec/support/models/article_tag.rb
spec/support/models/article_tag.rb
# frozen_string_literal: true class ArticleTag def self.policy_class ArticleTagOtherNamePolicy end end
ruby
MIT
3488802b2f218ba26562e91186655297c95eb6da
2026-01-04T15:38:58.048292Z
false
varvet/pundit
https://github.com/varvet/pundit/blob/3488802b2f218ba26562e91186655297c95eb6da/spec/support/models/foo.rb
spec/support/models/foo.rb
# frozen_string_literal: true class Foo end
ruby
MIT
3488802b2f218ba26562e91186655297c95eb6da
2026-01-04T15:38:58.048292Z
false
varvet/pundit
https://github.com/varvet/pundit/blob/3488802b2f218ba26562e91186655297c95eb6da/spec/support/models/post_four_five_six.rb
spec/support/models/post_four_five_six.rb
# frozen_string_literal: true class PostFourFiveSix def initialize(user) @user = user end attr_reader(:user) end
ruby
MIT
3488802b2f218ba26562e91186655297c95eb6da
2026-01-04T15:38:58.048292Z
false
varvet/pundit
https://github.com/varvet/pundit/blob/3488802b2f218ba26562e91186655297c95eb6da/spec/support/models/comment_scope.rb
spec/support/models/comment_scope.rb
# frozen_string_literal: true class CommentScope attr_reader :original_object def initialize(original_object) @original_object = original_object end def ==(other) original_object == other.original_object end end
ruby
MIT
3488802b2f218ba26562e91186655297c95eb6da
2026-01-04T15:38:58.048292Z
false
varvet/pundit
https://github.com/varvet/pundit/blob/3488802b2f218ba26562e91186655297c95eb6da/spec/support/models/article.rb
spec/support/models/article.rb
# frozen_string_literal: true class Article end
ruby
MIT
3488802b2f218ba26562e91186655297c95eb6da
2026-01-04T15:38:58.048292Z
false
varvet/pundit
https://github.com/varvet/pundit/blob/3488802b2f218ba26562e91186655297c95eb6da/spec/support/models/comment.rb
spec/support/models/comment.rb
# frozen_string_literal: true class Comment extend ActiveModel::Naming end
ruby
MIT
3488802b2f218ba26562e91186655297c95eb6da
2026-01-04T15:38:58.048292Z
false
varvet/pundit
https://github.com/varvet/pundit/blob/3488802b2f218ba26562e91186655297c95eb6da/spec/support/models/post.rb
spec/support/models/post.rb
# frozen_string_literal: true class Post def initialize(user = nil) @user = user end attr_reader :user def self.published :published end def self.read :read end def to_s "Post" end def inspect "#<Post>" end end
ruby
MIT
3488802b2f218ba26562e91186655297c95eb6da
2026-01-04T15:38:58.048292Z
false
varvet/pundit
https://github.com/varvet/pundit/blob/3488802b2f218ba26562e91186655297c95eb6da/spec/support/models/blog.rb
spec/support/models/blog.rb
# frozen_string_literal: true class Blog end
ruby
MIT
3488802b2f218ba26562e91186655297c95eb6da
2026-01-04T15:38:58.048292Z
false
varvet/pundit
https://github.com/varvet/pundit/blob/3488802b2f218ba26562e91186655297c95eb6da/spec/support/models/wiki.rb
spec/support/models/wiki.rb
# frozen_string_literal: true class Wiki end
ruby
MIT
3488802b2f218ba26562e91186655297c95eb6da
2026-01-04T15:38:58.048292Z
false
varvet/pundit
https://github.com/varvet/pundit/blob/3488802b2f218ba26562e91186655297c95eb6da/spec/support/models/comments_relation.rb
spec/support/models/comments_relation.rb
# frozen_string_literal: true class CommentsRelation def initialize(empty: false) @empty = empty end def blank? @empty end def self.model_name Comment.model_name end end
ruby
MIT
3488802b2f218ba26562e91186655297c95eb6da
2026-01-04T15:38:58.048292Z
false
varvet/pundit
https://github.com/varvet/pundit/blob/3488802b2f218ba26562e91186655297c95eb6da/spec/support/models/default_scope_contains_error.rb
spec/support/models/default_scope_contains_error.rb
# frozen_string_literal: true class DefaultScopeContainsError def self.all; end end
ruby
MIT
3488802b2f218ba26562e91186655297c95eb6da
2026-01-04T15:38:58.048292Z
false