trivia_factory 0.1.2 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +5 -1
- data/lib/data/academy_awards.csv +174 -0
- data/lib/trivia_factory/academy_awards_question.rb +31 -0
- data/lib/trivia_factory/version.rb +1 -1
- data/lib/trivia_factory.rb +5 -0
- metadata +3 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 35dd5c988711f9b1070a871dede6403bada35633
|
|
4
|
+
data.tar.gz: d40d894a398b023662cf77d64e0296f7abb8d055
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 63c9524357b8d83d61e9263c3a143a085beb69c1b0ccc696e6a5575ce22c24a67f6381709737f6fb8adbcf4a274c6261d5208d79ac0623c01c42452b6646814f
|
|
7
|
+
data.tar.gz: 0b60c5d3cb15fcc86922aadb18d221d384f9d278ff74c2f465e0afd8cfe23a23a767595d4e851eb45aa0e04bf83d0cfedb0a96778db543dbe2de2d0706fa914d
|
data/README.md
CHANGED
|
@@ -67,6 +67,10 @@ Currently the following question categories exist as subclasses of `TriviaFactor
|
|
|
67
67
|
|
|
68
68
|
**TriviaFactory::UsStateCapitalsQuestion**: generates a question about US state capitals.
|
|
69
69
|
|
|
70
|
+
**TriviaFactory::CapitalCitiesQuestion**: generates a question about capital cities (worldwide)
|
|
71
|
+
|
|
72
|
+
**TriviaFactory::AcademyAwardsQuestion**: generates a question about academy award winners
|
|
73
|
+
|
|
70
74
|
**TriviaFactory::VocabularyQuestion**: generates a multiple choice vocabulary *word* <-> *definition* question. From a list of 1,000 vocabulary study words.
|
|
71
75
|
|
|
72
76
|
To create a question from any of these types, simply call the `generate()` method on any of the classes.
|
|
@@ -74,7 +78,7 @@ To create a question from any of these types, simply call the `generate()` metho
|
|
|
74
78
|
### More examples
|
|
75
79
|
|
|
76
80
|
```
|
|
77
|
-
# Math question can accept a max param that can limit the size of operands
|
|
81
|
+
# Math question can accept a max param that can limit the size of operands (default is 100)
|
|
78
82
|
q = TriviaFactory::MathQuestion.generate(20)
|
|
79
83
|
q.to_h
|
|
80
84
|
=> {
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
best actor in a leading role,Warner Baxter,In Old Arizona,1930
|
|
2
|
+
best actor in a leading role,George Arliss,Disraeli,1930
|
|
3
|
+
best actor in a leading role,Lionel Barrymore,A Free Soul,1931
|
|
4
|
+
best actor in a leading role,Wallace Beery,The Champ,1932
|
|
5
|
+
best actor in a leading role,Fredric March,Dr. Jekyll and Mr. Hyde,1932
|
|
6
|
+
best actor in a leading role,Charles Laughton,The Private Life of Henry VIII,1934
|
|
7
|
+
best actor in a leading role,Clark Gable,It Happened One Night,1935
|
|
8
|
+
best actor in a leading role,Victor McLaglen,The Informer,1936
|
|
9
|
+
best actor in a leading role,Paul Muni,The Story of Louis Pasteur,1937
|
|
10
|
+
best actor in a leading role,Spencer Tracy,Captains Courageous,1938
|
|
11
|
+
best actor in a leading role,Spencer Tracy,Boys Town,1939
|
|
12
|
+
best actor in a leading role,Robert Donat,"Goodbye, Mr. Chips",1940
|
|
13
|
+
best actor in a leading role,James Stewart,The Philadelphia Story,1941
|
|
14
|
+
best actor in a leading role,Gary Cooper,Sergeant York,1942
|
|
15
|
+
best actor in a leading role,James Cagney,Yankee Doodle Dandy,1943
|
|
16
|
+
best actor in a leading role,Paul Lukas,Watch on the Rhine,1944
|
|
17
|
+
best actor in a leading role,Bing Crosby,Going My Way,1945
|
|
18
|
+
best actor in a leading role,Ray Milland,The Lost Weekend,1946
|
|
19
|
+
best actor in a leading role,Fredric March,The Best Years of Our Lives,1947
|
|
20
|
+
best actor in a leading role,Ronald Colman,A Double Life,1948
|
|
21
|
+
best actor in a leading role,Laurence Olivier,Hamlet,1949
|
|
22
|
+
best actor in a leading role,Broderick Crawford,All the King's Men,1950
|
|
23
|
+
best actor in a leading role,José Ferrer,Cyrano de Bergerac,1951
|
|
24
|
+
best actor in a leading role,Humphrey Bogart,The African Queen,1952
|
|
25
|
+
best actor in a leading role,Gary Cooper,High Noon,1953
|
|
26
|
+
best actor in a leading role,William Holden,Stalag 17,1954
|
|
27
|
+
best actor in a leading role,Marlon Brando,On the Waterfront,1955
|
|
28
|
+
best actor in a leading role,Ernest Borgnine,Marty,1956
|
|
29
|
+
best actor in a leading role,Yul Brynner,The King and I,1957
|
|
30
|
+
best actor in a leading role,Alec Guinness,The Bridge on the River Kwai,1958
|
|
31
|
+
best actor in a leading role,David Niven,Separate Tables,1959
|
|
32
|
+
best actor in a leading role,Charlton Heston,Ben-Hur,1960
|
|
33
|
+
best actor in a leading role,Burt Lancaster,Elmer Gantry,1961
|
|
34
|
+
best actor in a leading role,Maximilian Schell,Judgment at Nuremberg,1962
|
|
35
|
+
best actor in a leading role,Gregory Peck,To Kill a Mockingbird,1963
|
|
36
|
+
best actor in a leading role,Sidney Poitier,Lilies of the Field,1964
|
|
37
|
+
best actor in a leading role,Rex Harrison,My Fair Lady,1965
|
|
38
|
+
best actor in a leading role,Lee Marvin,Cat Ballou,1966
|
|
39
|
+
best actor in a leading role,Paul Scofield,A Man for All Seasons,1967
|
|
40
|
+
best actor in a leading role,Rod Steiger,In the Heat of the Night,1968
|
|
41
|
+
best actor in a leading role,Cliff Robertson,Charly,1969
|
|
42
|
+
best actor in a leading role,John Wayne,True Grit,1970
|
|
43
|
+
best actor in a leading role,George C. Scott,Patton,1971
|
|
44
|
+
best actor in a leading role,Gene Hackman,The French Connection,1972
|
|
45
|
+
best actor in a leading role,Marlon Brando,The Godfather,1973
|
|
46
|
+
best actor in a leading role,Jack Lemmon,Save the Tiger,1974
|
|
47
|
+
best actor in a leading role,Art Carney,Harry and Tonto,1975
|
|
48
|
+
best actor in a leading role,Jack Nicholson,One Flew Over the Cuckoo's Nest,1976
|
|
49
|
+
best actor in a leading role,Peter Finch,Network,1977
|
|
50
|
+
best actor in a leading role,Richard Dreyfuss,The Goodbye Girl,1978
|
|
51
|
+
best actor in a leading role,Jon Voight,Coming Home,1979
|
|
52
|
+
best actor in a leading role,Dustin Hoffman,Kramer vs. Kramer,1980
|
|
53
|
+
best actor in a leading role,Robert De Niro,Raging Bull,1981
|
|
54
|
+
best actor in a leading role,Henry Fonda,On Golden Pond,1982
|
|
55
|
+
best actor in a leading role,Ben Kingsley,Gandhi,1983
|
|
56
|
+
best actor in a leading role,Robert Duvall,Tender Mercies,1984
|
|
57
|
+
best actor in a leading role,F. Murray Abraham,Amadeus,1985
|
|
58
|
+
best actor in a leading role,William Hurt,Kiss of the Spider Woman,1986
|
|
59
|
+
best actor in a leading role,Paul Newman,The Color of Money,1987
|
|
60
|
+
best actor in a leading role,Michael Douglas,Wall Street,1988
|
|
61
|
+
best actor in a leading role,Dustin Hoffman,Rain Man,1989
|
|
62
|
+
best actor in a leading role,Daniel Day-Lewis,My Left Foot,1990
|
|
63
|
+
best actor in a leading role,Jeremy Irons,Reversal of Fortune,1991
|
|
64
|
+
best actor in a leading role,Anthony Hopkins,The Silence of the Lambs,1992
|
|
65
|
+
best actor in a leading role,Al Pacino,Scent of a Woman,1993
|
|
66
|
+
best actor in a leading role,Tom Hanks,Philadelphia,1994
|
|
67
|
+
best actor in a leading role,Tom Hanks,Forrest Gump,1995
|
|
68
|
+
best actor in a leading role,Nicolas Cage,Leaving Las Vegas,1996
|
|
69
|
+
best actor in a leading role,Geoffrey Rush,Shine,1997
|
|
70
|
+
best actor in a leading role,Jack Nicholson,As Good as It Gets,1998
|
|
71
|
+
best actor in a leading role,Roberto Benigni,Life Is Beautiful,1999
|
|
72
|
+
best actor in a leading role,Kevin Spacey,American Beauty,2000
|
|
73
|
+
best actor in a leading role,Russell Crowe,Gladiator,2001
|
|
74
|
+
best actor in a leading role,Denzel Washington,Training Day,2002
|
|
75
|
+
best actor in a leading role,Adrien Brody,The Pianist,2003
|
|
76
|
+
best actor in a leading role,Sean Penn,Mystic River,2004
|
|
77
|
+
best actor in a leading role,Jamie Foxx,Ray,2005
|
|
78
|
+
best actor in a leading role,Philip Seymour Hoffman,Capote,2006
|
|
79
|
+
best actor in a leading role,Forest Whitaker,The Last King of Scotland,2007
|
|
80
|
+
best actor in a leading role,Daniel Day-Lewis,There Will Be Blood,2008
|
|
81
|
+
best actor in a leading role,Sean Penn,Milk,2009
|
|
82
|
+
best actor in a leading role,Jeff Bridges,Crazy Heart,2010
|
|
83
|
+
best actor in a leading role,Colin Firth,The King's Speech,2011
|
|
84
|
+
best actor in a leading role,Jean Dujardin,The Artist,2012
|
|
85
|
+
best actor in a leading role,Daniel Day-Lewis,Lincoln,2013
|
|
86
|
+
best actor in a leading role,Matthew McConaughey,Dallas Buyers Club,2014
|
|
87
|
+
best actor in a leading role,Eddie Redmayne,The Theory of Everything,2015
|
|
88
|
+
best actor in a leading role,Leonardo DiCaprio,The Revenant,2016
|
|
89
|
+
best actor in a leading role,Casey Affleck,Manchester by the Sea,2017
|
|
90
|
+
best actress in a leading role,Katharine Hepburn,Morning Glory,1934
|
|
91
|
+
best actress in a leading role,Claudette Colbert,It Happened One Night,1935
|
|
92
|
+
best actress in a leading role,Bette Davis,Dangerous,1936
|
|
93
|
+
best actress in a leading role,Luise Rainer,The Great Ziegfeld,1937
|
|
94
|
+
best actress in a leading role,Luise Rainer,The Good Earth,1938
|
|
95
|
+
best actress in a leading role,Bette Davis,Jezebel,1939
|
|
96
|
+
best actress in a leading role,Vivien Leigh,Gone with the Wind,1940
|
|
97
|
+
best actress in a leading role,Ginger Rogers,Kitty Foyle,1941
|
|
98
|
+
best actress in a leading role,Joan Fontaine,Suspicion,1942
|
|
99
|
+
best actress in a leading role,Greer Garson,Mrs. Miniver,1943
|
|
100
|
+
best actress in a leading role,Jennifer Jones,The Song of Bernadette,1944
|
|
101
|
+
best actress in a leading role,Ingrid Bergman,Gaslight,1945
|
|
102
|
+
best actress in a leading role,Joan Crawford,Mildred Pierce,1946
|
|
103
|
+
best actress in a leading role,Olivia de Havilland,To Each His Own,1947
|
|
104
|
+
best actress in a leading role,Loretta Young,The Farmer's Daughter,1948
|
|
105
|
+
best actress in a leading role,Jane Wyman,Johnny Belinda,1949
|
|
106
|
+
best actress in a leading role,Olivia de Havilland,The Heiress,1950
|
|
107
|
+
best actress in a leading role,Judy Holliday,Born Yesterday,1951
|
|
108
|
+
best actress in a leading role,Vivien Leigh,A Streetcar Named Desire,1952
|
|
109
|
+
best actress in a leading role,Shirley Booth,"Come Back, Little Sheba",1953
|
|
110
|
+
best actress in a leading role,Audrey Hepburn,Roman Holiday,1954
|
|
111
|
+
best actress in a leading role,Grace Kelly,The Country Girl,1955
|
|
112
|
+
best actress in a leading role,Anna Magnani,The Rose Tattoo,1956
|
|
113
|
+
best actress in a leading role,Ingrid Bergman,Anastasia,1957
|
|
114
|
+
best actress in a leading role,Joanne Woodward,The Three Faces of Eve,1958
|
|
115
|
+
best actress in a leading role,Susan Hayward,I Want to Live!,1959
|
|
116
|
+
best actress in a leading role,Simone Signoret,Room at the Top,1960
|
|
117
|
+
best actress in a leading role,Elizabeth Taylor,BUtterfield 8,1961
|
|
118
|
+
best actress in a leading role,Sophia Loren,Two Women,1962
|
|
119
|
+
best actress in a leading role,Anne Bancroft,The Miracle Worker,1963
|
|
120
|
+
best actress in a leading role,Patricia Neal,Hud,1964
|
|
121
|
+
best actress in a leading role,Julie Andrews,Mary Poppins,1965
|
|
122
|
+
best actress in a leading role,Julie Christie,Darling,1966
|
|
123
|
+
best actress in a leading role,Elizabeth Taylor,Who's Afraid of Virginia Woolf?,1967
|
|
124
|
+
best actress in a leading role,Katharine Hepburn,Guess Who's Coming to Dinner,1968
|
|
125
|
+
best actress in a leading role,Katharine Hepburn,The Lion in Winter,1969
|
|
126
|
+
best actress in a leading role,Barbra Streisand,Funny Girl,1969
|
|
127
|
+
best actress in a leading role,Maggie Smith,The Prime of Miss Jean Brodie,1970
|
|
128
|
+
best actress in a leading role,Glenda Jackson,Women in Love,1971
|
|
129
|
+
best actress in a leading role,Jane Fonda,Klute,1972
|
|
130
|
+
best actress in a leading role,Liza Minnelli,Cabaret,1973
|
|
131
|
+
best actress in a leading role,Glenda Jackson,A Touch of Class,1974
|
|
132
|
+
best actress in a leading role,Ellen Burstyn,Alice Doesn't Live Here Anymore,1975
|
|
133
|
+
best actress in a leading role,Louise Fletcher,One Flew Over the Cuckoo's Nest,1976
|
|
134
|
+
best actress in a leading role,Faye Dunaway,Network,1977
|
|
135
|
+
best actress in a leading role,Diane Keaton,Annie Hall,1978
|
|
136
|
+
best actress in a leading role,Jane Fonda,Coming Home,1979
|
|
137
|
+
best actress in a leading role,Sally Field,Norma Rae,1980
|
|
138
|
+
best actress in a leading role,Sissy Spacek,Coal Miner's Daughter,1981
|
|
139
|
+
best actress in a leading role,Katharine Hepburn,On Golden Pond,1982
|
|
140
|
+
best actress in a leading role,Meryl Streep,Sophie's Choice,1983
|
|
141
|
+
best actress in a leading role,Shirley MacLaine,Terms of Endearment,1984
|
|
142
|
+
best actress in a leading role,Sally Field,Places in the Heart,1985
|
|
143
|
+
best actress in a leading role,Geraldine Page,The Trip to Bountiful,1986
|
|
144
|
+
best actress in a leading role,Marlee Matlin,Children of a Lesser God,1987
|
|
145
|
+
best actress in a leading role,Cher,Moonstruck,1988
|
|
146
|
+
best actress in a leading role,Jodie Foster,The Accused,1989
|
|
147
|
+
best actress in a leading role,Jessica Tandy,Driving Miss Daisy,1990
|
|
148
|
+
best actress in a leading role,Kathy Bates,Misery,1991
|
|
149
|
+
best actress in a leading role,Jodie Foster,The Silence of the Lambs,1992
|
|
150
|
+
best actress in a leading role,Emma Thompson,Howards End,1993
|
|
151
|
+
best actress in a leading role,Holly Hunter,The Piano,1994
|
|
152
|
+
best actress in a leading role,Jessica Lange,Blue Sky,1995
|
|
153
|
+
best actress in a leading role,Susan Sarandon,Dead Man Walking,1996
|
|
154
|
+
best actress in a leading role,Frances McDormand,Fargo,1997
|
|
155
|
+
best actress in a leading role,Helen Hunt,As Good as It Gets,1998
|
|
156
|
+
best actress in a leading role,Gwyneth Paltrow,Shakespeare in Love,1999
|
|
157
|
+
best actress in a leading role,Hilary Swank,Boys Don't Cry,2000
|
|
158
|
+
best actress in a leading role,Julia Roberts,Erin Brockovich,2001
|
|
159
|
+
best actress in a leading role,Halle Berry,Monster's Ball,2002
|
|
160
|
+
best actress in a leading role,Nicole Kidman,The Hours,2003
|
|
161
|
+
best actress in a leading role,Charlize Theron,Monster,2004
|
|
162
|
+
best actress in a leading role,Hilary Swank,Million Dollar Baby,2005
|
|
163
|
+
best actress in a leading role,Reese Witherspoon,Walk the Line,2006
|
|
164
|
+
best actress in a leading role,Helen Mirren,The Queen,2007
|
|
165
|
+
best actress in a leading role,Marion Cotillard,La Vie en rose,2008
|
|
166
|
+
best actress in a leading role,Kate Winslet,The Reader,2009
|
|
167
|
+
best actress in a leading role,Sandra Bullock,The Blind Side,2010
|
|
168
|
+
best actress in a leading role,Natalie Portman,Black Swan,2011
|
|
169
|
+
best actress in a leading role,Meryl Streep,The Iron Lady,2012
|
|
170
|
+
best actress in a leading role,Jennifer Lawrence,Silver Linings Playbook,2013
|
|
171
|
+
best actress in a leading role,Cate Blanchett,Blue Jasmine,2014
|
|
172
|
+
best actress in a leading role,Julianne Moore,Still Alice,2015
|
|
173
|
+
best actress in a leading role,Brie Larson,Room,2016
|
|
174
|
+
best actress in a leading role,Emma Stone,La La Land,2017
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
module TriviaFactory
|
|
2
|
+
class AcademyAwardsQuestion < Question
|
|
3
|
+
|
|
4
|
+
class << self
|
|
5
|
+
def generate
|
|
6
|
+
# File: vocabulary.csv
|
|
7
|
+
# 0: award
|
|
8
|
+
# 1: winner
|
|
9
|
+
# 2: movie
|
|
10
|
+
# 3: year
|
|
11
|
+
question = TriviaFactory::Question.new
|
|
12
|
+
data = fetch_csv('academy_awards')
|
|
13
|
+
answer_row = data.sample
|
|
14
|
+
question = TriviaFactory::VocabularyQuestion.new
|
|
15
|
+
question.label = "In #{answer_row[3]} #{answer_row[1]} won the academy award for #{answer_row[0]} for what film?"
|
|
16
|
+
question.choices = [answer_row[2]]
|
|
17
|
+
question.question_type = :multiple_choice
|
|
18
|
+
question.answer_type = :choice_index
|
|
19
|
+
loop do
|
|
20
|
+
row = data.sample
|
|
21
|
+
question.choices << row[2] if question.choices.index(row[2]).nil?
|
|
22
|
+
break if question.choices.size == 4
|
|
23
|
+
end
|
|
24
|
+
question.choices.shuffle!
|
|
25
|
+
question.answer = question.choices.index(answer_row[2])
|
|
26
|
+
question
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
end
|
|
31
|
+
end
|
data/lib/trivia_factory.rb
CHANGED
|
@@ -62,6 +62,10 @@ module TriviaFactory
|
|
|
62
62
|
TriviaFactory::SportsQuestion.generate
|
|
63
63
|
end
|
|
64
64
|
|
|
65
|
+
def academy_awards
|
|
66
|
+
TriviaFactory::AcademyAwardsQuestion.generate
|
|
67
|
+
end
|
|
68
|
+
|
|
65
69
|
def vocabulary
|
|
66
70
|
TriviaFactory::VocabularyQuestion.generate
|
|
67
71
|
end
|
|
@@ -79,3 +83,4 @@ require "trivia_factory/math_question"
|
|
|
79
83
|
require "trivia_factory/sports_question"
|
|
80
84
|
require "trivia_factory/us_state_capitals_question"
|
|
81
85
|
require "trivia_factory/capital_cities_question"
|
|
86
|
+
require "trivia_factory/academy_awards_question"
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: trivia_factory
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.3
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Callmeed
|
|
@@ -71,11 +71,13 @@ files:
|
|
|
71
71
|
- Rakefile
|
|
72
72
|
- bin/console
|
|
73
73
|
- bin/setup
|
|
74
|
+
- lib/data/academy_awards.csv
|
|
74
75
|
- lib/data/capital_cities.csv
|
|
75
76
|
- lib/data/sports_champions.csv
|
|
76
77
|
- lib/data/us_state_capitals.csv
|
|
77
78
|
- lib/data/vocabulary.csv
|
|
78
79
|
- lib/trivia_factory.rb
|
|
80
|
+
- lib/trivia_factory/academy_awards_question.rb
|
|
79
81
|
- lib/trivia_factory/capital_cities_question.rb
|
|
80
82
|
- lib/trivia_factory/math_question.rb
|
|
81
83
|
- lib/trivia_factory/sports_question.rb
|