nerd_quiz 0.1.3 → 0.1.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -6,7 +6,7 @@
6
6
  "a1": "Super",
7
7
  "a2": "Object",
8
8
  "a3": "Mother",
9
- "a4": "Base-Object",
9
+ "a4": "BasicObject",
10
10
  "right_answer": "a4",
11
11
  "created_at": "2011-06-07",
12
12
  "creator": "Paul"
@@ -0,0 +1,15 @@
1
+ {
2
+ "question": {
3
+ "nerd_level": 4,
4
+ "text": "How do you pronounce '>>='?",
5
+ "a1": "bind",
6
+ "a2": "monad",
7
+ "a3": "monoid",
8
+ "a4": "shiftshiftequals",
9
+ "right_answer": "a1",
10
+ "creator": "Steve Klabnik",
11
+ "created_at": "2012-03-24",
12
+ "sub_category": "haskell",
13
+ "category": "programming"
14
+ }
15
+ }
@@ -0,0 +1,15 @@
1
+ {
2
+ "question": {
3
+ "nerd_level": 5,
4
+ "text": "What is the type signature of '>>='?",
5
+ "a1": "(>>=) :: m a -> (a -> b) -> b",
6
+ "a2": "(>>=) :: m a -> (a -> m b) -> m",
7
+ "a3": "(>>=) :: m a -> (b -> m b) -> m b",
8
+ "a4": "(>>=) :: m a -> (a -> m b) -> m b",
9
+ "right_answer": "a4",
10
+ "creator": "Steve Klabnik",
11
+ "created_at": "2012-03-24",
12
+ "sub_category": "haskell",
13
+ "category": "programming"
14
+ }
15
+ }
@@ -6,8 +6,8 @@
6
6
  "a1": "/[\\w.!\\$%+-].@[\\w-]+(?\\.[\\w-]+)+/",
7
7
  "a2": "/[\\w.!#\\$%+-]+@[\\w-]+(?:\\.[\\w-]+)+/",
8
8
  "a3": "/[\\w.+!#\\$%+]+@[\\w-]+(?\\.[\\w-]+)+/",
9
- "a4": "/[\\w.!\\$%+-]+@[\\w-].(?:\\.[\\w-]+)-/",
10
- "right_answer": "a2",
9
+ "a4": "None, you shouldn't validate emails with a regular expression.",
10
+ "right_answer": "a4",
11
11
  "created_at": "2011-06-07",
12
12
  "creator": "tmschndr"
13
13
  }
@@ -0,0 +1,15 @@
1
+ {
2
+ "question": {
3
+ "nerd_level": 3,
4
+ "text": "How many elements are in this list: list <- [1..] ?",
5
+ "a1": "Zero",
6
+ "a2": "Infinity",
7
+ "a3": "As many as you ask it for",
8
+ "a4": "a1 and a3",
9
+ "right_answer": "a4",
10
+ "creator": "Steve Klabnik",
11
+ "created_at": "2012-03-24",
12
+ "sub_category": "haskell",
13
+ "category": "programming"
14
+ }
15
+ }
@@ -2,7 +2,7 @@
2
2
  "sub_category": "ruby",
3
3
  "category": "culture",
4
4
  "nerd_level": 1,
5
- "text":"When Matz joined Heruku?",
5
+ "text":"When Matz joined Heroku?",
6
6
  "a1": "12th June 2008",
7
7
  "a2": "12th July 2011",
8
8
  "a3": "12th June 2011",
@@ -0,0 +1,15 @@
1
+ {
2
+ "question": {
3
+ "nerd_level": 5,
4
+ "text": "What is a monad?",
5
+ "a1": "A burrito",
6
+ "a2": "A monoid in the category of endofunctors.",
7
+ "a3": "Impossible to understand",
8
+ "a4": "The only functional way to do I/O.",
9
+ "right_answer": "a2",
10
+ "creator": "Steve Klabnik",
11
+ "created_at": "2012-03-24",
12
+ "sub_category": "haskell",
13
+ "category": "programming"
14
+ }
15
+ }
@@ -0,0 +1,15 @@
1
+ {
2
+ "question": {
3
+ "nerd_level": 5,
4
+ "text": "Are monads monoids?",
5
+ "a1": "Yes",
6
+ "a2": "No",
7
+ "a3": "Sometimes yes, sometimes no",
8
+ "a4": "Always both a1 and a2",
9
+ "right_answer": "a1",
10
+ "creator": "Steve Klabnik",
11
+ "created_at": "2012-03-24",
12
+ "sub_category": "haskell",
13
+ "category": "programming"
14
+ }
15
+ }
@@ -0,0 +1,15 @@
1
+ {
2
+ "question": {
3
+ "nerd_level": 5,
4
+ "text": "What is a monoid?",
5
+ "a1": "A burrito",
6
+ "a2": "A trigometric structure with bind and mplus",
7
+ "a3": "An algebraic structure with a single associative binary operation & an identity element.",
8
+ "a4": "A way of doing I/O.",
9
+ "right_answer": "a3",
10
+ "creator": "Steve Klabnik",
11
+ "created_at": "2012-03-24",
12
+ "sub_category": "haskell",
13
+ "category": "programming"
14
+ }
15
+ }
@@ -0,0 +1,15 @@
1
+ {
2
+ "question": {
3
+ "nerd_level": 1,
4
+ "text": "What does 'REST' stand for?",
5
+ "a1": "Rails Enterprise Statistics Transformation",
6
+ "a2": "REady STate",
7
+ "a3": "REpresentational State Transfer",
8
+ "a4": "Ruby Enterprise Substitutiona Tool",
9
+ "right_answer": "a3",
10
+ "creator": "Steve Klabnik",
11
+ "created_at": "2012-03-24",
12
+ "sub_category": "api",
13
+ "category": "programming"
14
+ }
15
+ }
@@ -0,0 +1,15 @@
1
+ {
2
+ "question": {
3
+ "nerd_level": 1,
4
+ "text": "Who developed REST?",
5
+ "a1": "DHH",
6
+ "a2": "Guido Van Rossum",
7
+ "a3": "Peter Norvig",
8
+ "a4": "Roy Fielding",
9
+ "right_answer": "a4",
10
+ "creator": "Steve Klabnik",
11
+ "created_at": "2012-03-24",
12
+ "sub_category": "api",
13
+ "category": "programming"
14
+ }
15
+ }
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Nerd Quiz
2
- ## Test your nerd skills by answering NerdPursuit questions!
3
- A ruby gem which implements a command line interface to NerdPursuit questions
2
+ ## Test your nerd skills by answering [NerdPursuit](https://github.com/Nerds/NerdPursuit) questions!
3
+ A ruby gem which implements a command line interface to [NerdPursuit](https://github.com/Nerds/NerdPursuit) questions
4
4
 
5
5
  ## Installation
6
6
  gem install nerd_quiz
@@ -9,7 +9,8 @@ A ruby gem which implements a command line interface to NerdPursuit questions
9
9
  nquiz
10
10
 
11
11
  ## License
12
- Released under the MIT License. See the [LICENSE][license] file for further details.
12
+ nerd_quiz gem released under the MIT License. See the [LICENSE][license] file for further details.
13
13
 
14
- [license]: https://github.com/simeonwillbanks/nerd_quiz/blob/master/LICENSE
14
+ <a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/"><img alt="Creative Commons License" style="border-width:0" src="http://i.creativecommons.org/l/by-sa/3.0/88x31.png" /></a><br /><span xmlns:dct="http://purl.org/dc/terms/" href="http://purl.org/dc/dcmitype/Dataset" property="dct:title" rel="dct:type">Nerdpursuit</span> is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/">Creative Commons Attribution-ShareAlike 3.0 Unported License</a>. Based on a work at <a xmlns:dct="http://purl.org/dc/terms/" href="https://github.com/Nerds/NerdPursuit" rel="dct:source">github.com</a>.
15
15
 
16
+ [license]: https://github.com/simeonwillbanks/nerd_quiz/blob/master/LICENSE
@@ -6,6 +6,7 @@ module NerdQuiz
6
6
  @input = input
7
7
  @output = output
8
8
  @scorecard = scorecard
9
+ Signal.trap('INT', 'EXIT')
9
10
  end
10
11
 
11
12
  def run
@@ -16,21 +17,29 @@ module NerdQuiz
16
17
  listen
17
18
  end
18
19
  over
20
+ ensure
21
+ bye
19
22
  end
20
23
 
21
24
  private
25
+
26
+ def bye
27
+ out('Bye!', :blue, :bold)
28
+ end
29
+
22
30
  def ask
23
- @output.puts set_color("Question #{@scorecard.next_question + 1} #{label}:", :blue)
24
- @output.puts question
31
+ out("Question #{@scorecard.next_question + 1} #{label}:", :blue)
32
+ out(question)
25
33
  end
26
34
 
27
35
  def listen
28
36
  if reply == answer
29
- @output.puts set_color('Right!', :green, true)
37
+ out('Right!', :green, :bold)
30
38
  @scorecard.right_answer!
31
39
  else
32
- @output.puts set_color('Wrong!', :red, true)
33
- @output.puts set_color('You should have answered ', :red) + set_color(answer, :red, true)
40
+ out('Wrong!', :red, :bold)
41
+ # Do not nest ANSI sequences, so directly call set_color
42
+ out(set_color('You should have answered ', :red) + set_color(answer, :red, true))
34
43
  @scorecard.wrong_answer!
35
44
  end
36
45
  end
@@ -40,12 +49,12 @@ module NerdQuiz
40
49
  end
41
50
 
42
51
  def start
43
- @output.puts set_color('Welcome to Nerd Quiz', :blue)
52
+ out('Welcome to Nerd Quiz', :blue)
44
53
  end
45
54
 
46
55
  def over
47
- @output.puts set_color('Thanks For Playing!', :blue)
48
- @output.puts set_color("Final Score #{@scorecard.score}", :yellow)
56
+ out('Thanks For Playing!', :blue)
57
+ out("Final Score #{@scorecard.score}", :yellow)
49
58
  end
50
59
 
51
60
  def questions
@@ -64,5 +73,15 @@ module NerdQuiz
64
73
  def answer
65
74
  @question.answer
66
75
  end
76
+
77
+ def out(*args)
78
+ text = args[0]
79
+ unless args[1].nil?
80
+ color = args[1] || false
81
+ bold = args[2].is_a?(Symbol) ? true : false
82
+ text = set_color(text, color, bold)
83
+ end
84
+ @output.puts text
85
+ end
67
86
  end
68
87
  end
@@ -1,3 +1,3 @@
1
1
  module NerdQuiz
2
- VERSION = "0.1.3"
2
+ VERSION = "0.1.4"
3
3
  end
data/lib/nerd_quiz.rb CHANGED
@@ -1,11 +1,8 @@
1
1
  $LOAD_PATH.unshift(File.dirname(__FILE__)) if ARGV[0] == 'dev'
2
2
  require 'yajl'
3
- require 'nerd_quiz/version'
4
- require 'nerd_quiz/color'
5
- require 'nerd_quiz/quiz'
6
- require 'nerd_quiz/question'
7
- require 'nerd_quiz/questions'
8
- require 'nerd_quiz/scorecard'
3
+ %w{ version color quiz question questions scorecard }.each do |f|
4
+ require 'nerd_quiz/' + f
5
+ end
9
6
 
10
7
  module NerdQuiz
11
8
  DEFAULT_NUMBER_OF_QUESTIONS = 10
data/nerd_quiz.gemspec CHANGED
@@ -13,12 +13,11 @@ Gem::Specification.new do |s|
13
13
 
14
14
  s.rubyforge_project = 'nerd_quiz'
15
15
 
16
- s.files = [".gitignore",
16
+ s.files = [".rspec",
17
+ ".gitignore",
17
18
  ".gitmodules",
18
- ".rspec",
19
19
  "Gemfile",
20
20
  "LICENSE",
21
- "NerdPursuit",
22
21
  "README.md",
23
22
  "Rakefile",
24
23
  "STORIES.md",
@@ -36,177 +35,14 @@ Gem::Specification.new do |s|
36
35
  "spec/nerd_quiz/quiz_spec.rb",
37
36
  "spec/nerd_quiz/scorecard_spec.rb",
38
37
  "spec/spec_helper.rb",
39
- "NerdPursuit/questions/2_seconds.json",
40
- "NerdPursuit/questions/HTCPCP.json",
41
- "NerdPursuit/questions/about_ruby.json",
42
- "NerdPursuit/questions/absolute_superclass_1.8.json",
43
- "NerdPursuit/questions/absolute_superclass_1.9.json",
44
- "NerdPursuit/questions/active_record_base.json",
45
- "NerdPursuit/questions/all_ur_base.json",
46
- "NerdPursuit/questions/answer_to_everything.json",
47
- "NerdPursuit/questions/array_all_but_the_first.json",
48
- "NerdPursuit/questions/array_all_but_the_first_and_last .json",
49
- "NerdPursuit/questions/array_all_but_the_last.json",
50
- "NerdPursuit/questions/array_ampersand.json",
51
- "NerdPursuit/questions/array_get_and remove_first_element.json",
52
- "NerdPursuit/questions/array_get_and remove_last_element.json",
53
- "NerdPursuit/questions/array_pipe.json",
54
- "NerdPursuit/questions/array_splat.json",
55
- "NerdPursuit/questions/array_to_csv_string.json",
56
- "NerdPursuit/questions/attribute_selectors.json",
57
- "NerdPursuit/questions/background_image.json",
58
- "NerdPursuit/questions/backticks_in_ruby.json",
59
- "NerdPursuit/questions/base_object.json",
60
- "NerdPursuit/questions/best_language.json",
61
- "NerdPursuit/questions/bitwise_and.json",
62
- "NerdPursuit/questions/bitwise_or.json",
63
- "NerdPursuit/questions/chrome_v8.json",
64
- "NerdPursuit/questions/class_inheritance.json",
65
- "NerdPursuit/questions/club_mate_caffeine.json",
66
- "NerdPursuit/questions/collect_alternative.json",
67
- "NerdPursuit/questions/comparsion.json",
68
- "NerdPursuit/questions/constants.json",
69
- "NerdPursuit/questions/controller_action.json",
70
- "NerdPursuit/questions/date_format_month.json",
71
- "NerdPursuit/questions/divmod.json",
72
- "NerdPursuit/questions/emails.json",
73
- "NerdPursuit/questions/encoding.json",
74
- "NerdPursuit/questions/enumerable.json",
75
- "NerdPursuit/questions/equality.json",
76
- "NerdPursuit/questions/falsy.json",
77
- "NerdPursuit/questions/fastes_sorting_algorithm.json",
78
- "NerdPursuit/questions/fizzbuzz.json",
79
- "NerdPursuit/questions/float_left.json",
80
- "NerdPursuit/questions/folders.json",
81
- "NerdPursuit/questions/fps.json",
82
- "NerdPursuit/questions/fptr.json",
83
- "NerdPursuit/questions/fun_with_brackets.json",
84
- "NerdPursuit/questions/garbarge_collector_in_19.json",
85
- "NerdPursuit/questions/global_variable_character.json",
86
- "NerdPursuit/questions/half_a_byte.json",
87
- "NerdPursuit/questions/hash_with_indifferent_access.json",
88
- "NerdPursuit/questions/hexadecimal_code.json",
89
- "NerdPursuit/questions/how_can_you_access_the_data_pas.json",
90
- "NerdPursuit/questions/how_do_you_specify_html5_doctyp.json",
91
- "NerdPursuit/questions/how_do_you_use_multiple_box_sha.json",
92
- "NerdPursuit/questions/how_is_ruby_licensed.json",
93
- "NerdPursuit/questions/how_many_gems.json",
94
- "NerdPursuit/questions/how_many_pypi_packages.json",
95
- "NerdPursuit/questions/how_to_concatenate_list_python.json",
96
- "NerdPursuit/questions/how_to_delete_variable_python.json",
97
- "NerdPursuit/questions/how_to_indent_python.json",
98
- "NerdPursuit/questions/how_to_open_python_main.json",
99
- "NerdPursuit/questions/img_tag.json",
100
- "NerdPursuit/questions/instance_exec.json",
101
- "NerdPursuit/questions/invited-php.json",
102
- "NerdPursuit/questions/jquery_sizzle.json",
103
- "NerdPursuit/questions/json.json",
104
- "NerdPursuit/questions/jsonp.json",
105
- "NerdPursuit/questions/kanji_converter.json",
106
- "NerdPursuit/questions/kernel-sprintf-2.json",
107
- "NerdPursuit/questions/kernel-sprintf.json",
108
- "NerdPursuit/questions/kernel.json",
109
- "NerdPursuit/questions/last_cmd_sub.json",
110
- "NerdPursuit/questions/last_directory.json",
111
- "NerdPursuit/questions/lazy.json",
112
- "NerdPursuit/questions/list_comprehension_python.json",
113
- "NerdPursuit/questions/map_parseInt.json",
114
- "NerdPursuit/questions/matz.json",
115
- "NerdPursuit/questions/media.json",
116
- "NerdPursuit/questions/method_used_for_comparisions.json",
117
- "NerdPursuit/questions/min_max_quantifier.json",
118
- "NerdPursuit/questions/mixins_are_what.json",
119
- "NerdPursuit/questions/mutable_data_type.json",
120
- "NerdPursuit/questions/name_of_python_module_rep.json",
121
- "NerdPursuit/questions/negative_look_ahead.json",
122
- "NerdPursuit/questions/new_database.json",
123
- "NerdPursuit/questions/new_lambda_calling_syntax.json",
124
- "NerdPursuit/questions/new_lambda_constructing_syntax.json",
125
- "NerdPursuit/questions/nil.json",
126
- "NerdPursuit/questions/nil_id.json",
127
- "NerdPursuit/questions/nilclass.json",
128
- "NerdPursuit/questions/nodetype_of_text_node.json",
129
- "NerdPursuit/questions/numeric_types.json",
130
- "NerdPursuit/questions/ook_ook.json",
131
- "NerdPursuit/questions/optional_html_tags.json",
132
- "NerdPursuit/questions/oreilly_Antelope.json",
133
- "NerdPursuit/questions/oreilly_Camel.json",
134
- "NerdPursuit/questions/oreilly_Cow.json",
135
- "NerdPursuit/questions/oreilly_Insects.json",
136
- "NerdPursuit/questions/oreilly_Octopus.json",
137
- "NerdPursuit/questions/oreilly_Pidgeon.json",
138
- "NerdPursuit/questions/oreilly_Rat.json",
139
- "NerdPursuit/questions/oreilly_Rhinocerous.json",
140
- "NerdPursuit/questions/oreilly_Salmon.json",
141
- "NerdPursuit/questions/pluralize_person.json",
142
- "NerdPursuit/questions/png.json",
143
- "NerdPursuit/questions/position_fixed_support.json",
144
- "NerdPursuit/questions/position_property.json",
145
- "NerdPursuit/questions/prediction_gates.json",
146
- "NerdPursuit/questions/prefix_last_command.json",
147
- "NerdPursuit/questions/prime.json",
148
- "NerdPursuit/questions/private_method_in_ruby.json",
149
- "NerdPursuit/questions/protected_method_in_ruby.json",
150
- "NerdPursuit/questions/ps_save_for_web.json",
151
- "NerdPursuit/questions/quo.json",
152
- "NerdPursuit/questions/rails_first_shown.json",
153
- "NerdPursuit/questions/rails_inventor.json",
154
- "NerdPursuit/questions/rake_about.json",
155
- "NerdPursuit/questions/ranges_three_dots.json",
156
- "NerdPursuit/questions/release_date.json",
157
- "NerdPursuit/questions/return_value_or.json",
158
- "NerdPursuit/questions/roses.json",
159
- "NerdPursuit/questions/rspec_controller_render_views.json",
160
- "NerdPursuit/questions/run_time_of_bst.json",
161
- "NerdPursuit/questions/same_origin_policy.json",
162
- "NerdPursuit/questions/screen_image_resolution.json",
163
- "NerdPursuit/questions/simple_format.json",
164
- "NerdPursuit/questions/size_t_header.json",
165
- "NerdPursuit/questions/spaceship_operator.json",
166
- "NerdPursuit/questions/square_numbers_in_list.json",
167
- "NerdPursuit/questions/strict_doctype.json",
168
- "NerdPursuit/questions/string_clean_whitespace.json",
169
- "NerdPursuit/questions/string_object_coercion_internals.json",
170
- "NerdPursuit/questions/string_v_strings.h",
171
- "NerdPursuit/questions/sum_things_up.json",
172
- "NerdPursuit/questions/symbol_identity_01.json",
173
- "NerdPursuit/questions/symbol_identity_02.json",
174
- "NerdPursuit/questions/symbol_identity_03.json",
175
- "NerdPursuit/questions/symbol_string_ids.json",
176
- "NerdPursuit/questions/symbols.json",
177
- "NerdPursuit/questions/the_cake.json",
178
- "NerdPursuit/questions/the_difference_between_and_operators.json",
179
- "NerdPursuit/questions/to_which_year_marty_mcfly_wants.json",
180
- "NerdPursuit/questions/trace_something_in_as3.json",
181
- "NerdPursuit/questions/typeof_arguments.json",
182
- "NerdPursuit/questions/unless_wtf.json",
183
- "NerdPursuit/questions/valid_function_expression.json",
184
- "NerdPursuit/questions/weakref.json",
185
- "NerdPursuit/questions/what_did_matz_say_about_ruby.json",
186
- "NerdPursuit/questions/what_do_array.json",
187
- "NerdPursuit/questions/what_do_string.json",
188
- "NerdPursuit/questions/what_does_gil_stands_for.json",
189
- "NerdPursuit/questions/what_does_negate_regexp_operator_do.json",
190
- "NerdPursuit/questions/what_is_a_mixin.json",
191
- "NerdPursuit/questions/what_is_a_traditional_vulcan_sa.json",
192
- "NerdPursuit/questions/what_is_node_js.json",
193
- "NerdPursuit/questions/what_s_4_2.json",
194
- "NerdPursuit/questions/what_s_typeof_null.json",
195
- "NerdPursuit/questions/when_life_gives_you_lemons.json",
196
- "NerdPursuit/questions/where_are_the_characters_of_daw.json",
197
- "NerdPursuit/questions/which_character_in_star_trek_se.json",
198
- "NerdPursuit/questions/which_is_not_a_python_framework.json",
199
- "NerdPursuit/questions/which_version_of_ecmascript_doe.json",
200
- "NerdPursuit/questions/who_created_jquery.json",
201
- "NerdPursuit/questions/who_created_python.json",
202
- "NerdPursuit/questions/who_invented_node_js.json",
203
- "NerdPursuit/questions/who_is_the_first_character_to_b.json",
204
- "NerdPursuit/questions/yo_dawg.json",
205
- "NerdPursuit/questions/z-index_property.json"]
206
- s.test_files = ["spec/nerd_quiz/question_spec.rb",
207
- "spec/nerd_quiz/questions_spec.rb",
208
- "spec/nerd_quiz/quiz_spec.rb",
209
- "spec/nerd_quiz/scorecard_spec.rb",
38
+ # `ls NerdPursuit/questions/*.json`.split("\n")
39
+ "NerdPursuit/questions/2_seconds.json", "NerdPursuit/questions/HTCPCP.json", "NerdPursuit/questions/about_ruby.json", "NerdPursuit/questions/absolute_superclass_1.8.json", "NerdPursuit/questions/absolute_superclass_1.9.json", "NerdPursuit/questions/active_record_base.json", "NerdPursuit/questions/all_ur_base.json", "NerdPursuit/questions/answer_to_everything.json", "NerdPursuit/questions/array_all_but_the_first.json", "NerdPursuit/questions/array_all_but_the_first_and_last .json", "NerdPursuit/questions/array_all_but_the_last.json", "NerdPursuit/questions/array_ampersand.json", "NerdPursuit/questions/array_get_and remove_first_element.json", "NerdPursuit/questions/array_get_and remove_last_element.json", "NerdPursuit/questions/array_pipe.json", "NerdPursuit/questions/array_splat.json", "NerdPursuit/questions/array_to_csv_string.json", "NerdPursuit/questions/attribute_selectors.json", "NerdPursuit/questions/background_image.json", "NerdPursuit/questions/backticks_in_ruby.json", "NerdPursuit/questions/base_object.json", "NerdPursuit/questions/best_language.json", "NerdPursuit/questions/bind.json", "NerdPursuit/questions/bindtypesignature.json", "NerdPursuit/questions/bitwise_and.json", "NerdPursuit/questions/bitwise_or.json", "NerdPursuit/questions/chrome_v8.json", "NerdPursuit/questions/class_inheritance.json", "NerdPursuit/questions/club_mate_caffeine.json", "NerdPursuit/questions/collect_alternative.json", "NerdPursuit/questions/comparsion.json", "NerdPursuit/questions/constants.json", "NerdPursuit/questions/controller_action.json", "NerdPursuit/questions/date_format_month.json", "NerdPursuit/questions/divmod.json", "NerdPursuit/questions/emails.json", "NerdPursuit/questions/encoding.json", "NerdPursuit/questions/enumerable.json", "NerdPursuit/questions/equality.json", "NerdPursuit/questions/falsy.json", "NerdPursuit/questions/fastes_sorting_algorithm.json", "NerdPursuit/questions/fizzbuzz.json", "NerdPursuit/questions/float_left.json", "NerdPursuit/questions/folders.json", "NerdPursuit/questions/fps.json", "NerdPursuit/questions/fptr.json", "NerdPursuit/questions/fun_with_brackets.json", "NerdPursuit/questions/garbarge_collector_in_19.json", "NerdPursuit/questions/global_variable_character.json", "NerdPursuit/questions/half_a_byte.json", "NerdPursuit/questions/hash_with_indifferent_access.json", "NerdPursuit/questions/hexadecimal_code.json", "NerdPursuit/questions/how_can_you_access_the_data_pas.json", "NerdPursuit/questions/how_do_you_specify_html5_doctyp.json", "NerdPursuit/questions/how_do_you_use_multiple_box_sha.json", "NerdPursuit/questions/how_is_ruby_licensed.json", "NerdPursuit/questions/how_many_gems.json", "NerdPursuit/questions/how_many_pypi_packages.json", "NerdPursuit/questions/how_to_concatenate_list_python.json", "NerdPursuit/questions/how_to_delete_variable_python.json", "NerdPursuit/questions/how_to_indent_python.json", "NerdPursuit/questions/how_to_open_python_main.json", "NerdPursuit/questions/img_tag.json", "NerdPursuit/questions/instance_exec.json", "NerdPursuit/questions/invited-php.json", "NerdPursuit/questions/jquery_sizzle.json", "NerdPursuit/questions/json.json", "NerdPursuit/questions/jsonp.json", "NerdPursuit/questions/kanji_converter.json", "NerdPursuit/questions/kernel-sprintf-2.json", "NerdPursuit/questions/kernel-sprintf.json", "NerdPursuit/questions/kernel.json", "NerdPursuit/questions/last_cmd_sub.json", "NerdPursuit/questions/last_directory.json", "NerdPursuit/questions/laziness.json", "NerdPursuit/questions/lazy.json", "NerdPursuit/questions/list_comprehension_python.json", "NerdPursuit/questions/map_parseInt.json", "NerdPursuit/questions/matz.json", "NerdPursuit/questions/media.json", "NerdPursuit/questions/method_used_for_comparisions.json", "NerdPursuit/questions/min_max_quantifier.json", "NerdPursuit/questions/mixins_are_what.json", "NerdPursuit/questions/monads.json", "NerdPursuit/questions/monadsvsmonoids.json", "NerdPursuit/questions/monoids.json", "NerdPursuit/questions/mutable_data_type.json", "NerdPursuit/questions/name_of_python_module_rep.json", "NerdPursuit/questions/negative_look_ahead.json", "NerdPursuit/questions/new_database.json", "NerdPursuit/questions/new_lambda_calling_syntax.json", "NerdPursuit/questions/new_lambda_constructing_syntax.json", "NerdPursuit/questions/nil.json", "NerdPursuit/questions/nil_id.json", "NerdPursuit/questions/nilclass.json", "NerdPursuit/questions/nodetype_of_text_node.json", "NerdPursuit/questions/numeric_types.json", "NerdPursuit/questions/ook_ook.json", "NerdPursuit/questions/optional_html_tags.json", "NerdPursuit/questions/oreilly_Antelope.json", "NerdPursuit/questions/oreilly_Camel.json", "NerdPursuit/questions/oreilly_Cow.json", "NerdPursuit/questions/oreilly_Insects.json", "NerdPursuit/questions/oreilly_Octopus.json", "NerdPursuit/questions/oreilly_Pidgeon.json", "NerdPursuit/questions/oreilly_Rat.json", "NerdPursuit/questions/oreilly_Rhinocerous.json", "NerdPursuit/questions/oreilly_Salmon.json", "NerdPursuit/questions/pluralize_person.json", "NerdPursuit/questions/png.json", "NerdPursuit/questions/position_fixed_support.json", "NerdPursuit/questions/position_property.json", "NerdPursuit/questions/prediction_gates.json", "NerdPursuit/questions/prefix_last_command.json", "NerdPursuit/questions/prime.json", "NerdPursuit/questions/private_method_in_ruby.json", "NerdPursuit/questions/protected_method_in_ruby.json", "NerdPursuit/questions/ps_save_for_web.json", "NerdPursuit/questions/quo.json", "NerdPursuit/questions/rails_first_shown.json", "NerdPursuit/questions/rails_inventor.json", "NerdPursuit/questions/rake_about.json", "NerdPursuit/questions/ranges_three_dots.json", "NerdPursuit/questions/release_date.json", "NerdPursuit/questions/rest.json", "NerdPursuit/questions/rest_about.json", "NerdPursuit/questions/return_value_or.json", "NerdPursuit/questions/roses.json", "NerdPursuit/questions/rspec_controller_render_views.json", "NerdPursuit/questions/run_time_of_bst.json", "NerdPursuit/questions/same_origin_policy.json", "NerdPursuit/questions/screen_image_resolution.json", "NerdPursuit/questions/simple_format.json", "NerdPursuit/questions/size_t_header.json", "NerdPursuit/questions/spaceship_operator.json", "NerdPursuit/questions/square_numbers_in_list.json", "NerdPursuit/questions/strict_doctype.json", "NerdPursuit/questions/string_clean_whitespace.json", "NerdPursuit/questions/string_object_coercion_internals.json", "NerdPursuit/questions/sum_things_up.json", "NerdPursuit/questions/symbol_identity_01.json", "NerdPursuit/questions/symbol_identity_02.json", "NerdPursuit/questions/symbol_identity_03.json", "NerdPursuit/questions/symbol_string_ids.json", "NerdPursuit/questions/symbols.json", "NerdPursuit/questions/the_cake.json", "NerdPursuit/questions/the_difference_between_and_operators.json", "NerdPursuit/questions/to_which_year_marty_mcfly_wants.json", "NerdPursuit/questions/trace_something_in_as3.json", "NerdPursuit/questions/typeof_arguments.json", "NerdPursuit/questions/unless_wtf.json", "NerdPursuit/questions/valid_function_expression.json", "NerdPursuit/questions/weakref.json", "NerdPursuit/questions/what_did_matz_say_about_ruby.json", "NerdPursuit/questions/what_do_array.json", "NerdPursuit/questions/what_do_string.json", "NerdPursuit/questions/what_does_gil_stands_for.json", "NerdPursuit/questions/what_does_negate_regexp_operator_do.json", "NerdPursuit/questions/what_is_a_mixin.json", "NerdPursuit/questions/what_is_a_traditional_vulcan_sa.json", "NerdPursuit/questions/what_is_node_js.json", "NerdPursuit/questions/what_s_4_2.json", "NerdPursuit/questions/what_s_typeof_null.json", "NerdPursuit/questions/when_life_gives_you_lemons.json", "NerdPursuit/questions/where_are_the_characters_of_daw.json", "NerdPursuit/questions/which_character_in_star_trek_se.json", "NerdPursuit/questions/which_is_not_a_python_framework.json", "NerdPursuit/questions/which_version_of_ecmascript_doe.json", "NerdPursuit/questions/who_created_jquery.json", "NerdPursuit/questions/who_created_python.json", "NerdPursuit/questions/who_invented_node_js.json", "NerdPursuit/questions/who_is_the_first_character_to_b.json", "NerdPursuit/questions/yo_dawg.json", "NerdPursuit/questions/z-index_property.json"
40
+ ]
41
+ s.test_files = [".rspec",
42
+ "spec/nerd_quiz/question_spec.rb",
43
+ "spec/nerd_quiz/questions_spec.rb",
44
+ "spec/nerd_quiz/quiz_spec.rb",
45
+ "spec/nerd_quiz/scorecard_spec.rb",
210
46
  "spec/spec_helper.rb"]
211
47
  s.executables = %w(nquiz)
212
48
  s.require_paths = ['lib']
@@ -4,7 +4,7 @@ module NerdQuiz
4
4
  describe Quiz do
5
5
  let(:question) { 'What is the answer to life, the universe and everything?' }
6
6
  let(:answer) { '42' }
7
- let(:label) { '(culture)' }
7
+ let(:label) { '(culture)' }
8
8
  let(:output) { double('output').as_null_object }
9
9
  let(:input) { double('input').as_null_object }
10
10
  let(:scorecard) { NerdQuiz::Scorecard.new }
@@ -74,7 +74,7 @@ module NerdQuiz
74
74
  end
75
75
 
76
76
  it 'and displays the right answer' do
77
- output.should_receive(:puts).with("\e[31mYou should have answered \e[0m\e[1m\e[31m#{answer}\e[0m").exactly(10).times
77
+ output.should_receive(:puts).with("\e[31mYou should have answered \e[0m\e[1m\e[31m42\e[0m").exactly(10).times
78
78
  end
79
79
 
80
80
  it 'tallies the wrong answer' do
@@ -91,6 +91,10 @@ module NerdQuiz
91
91
  scorecard.stub(:score).and_return('10/10')
92
92
  output.should_receive(:puts).with("\e[33mFinal Score 10/10\e[0m")
93
93
  end
94
+
95
+ it 'always says bye' do
96
+ output.should_receive(:puts).with("\e[1m\e[34mBye!\e[0m")
97
+ end
94
98
  end
95
99
  end
96
100
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nerd_quiz
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-04-05 00:00:00.000000000 Z
12
+ date: 2012-04-08 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: yajl-ruby
16
- requirement: &70215627253160 !ruby/object:Gem::Requirement
16
+ requirement: &70189996098200 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70215627253160
24
+ version_requirements: *70189996098200
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: rake
27
- requirement: &70215627252340 !ruby/object:Gem::Requirement
27
+ requirement: &70189996097500 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '0'
33
33
  type: :development
34
34
  prerelease: false
35
- version_requirements: *70215627252340
35
+ version_requirements: *70189996097500
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: rspec
38
- requirement: &70215627251380 !ruby/object:Gem::Requirement
38
+ requirement: &70189996096820 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,7 +43,7 @@ dependencies:
43
43
  version: '0'
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *70215627251380
46
+ version_requirements: *70189996096820
47
47
  description: Test your nerd skills by answering NerdPursuit questions!
48
48
  email:
49
49
  - sfw@simeonfosterwillbanks.com
@@ -52,9 +52,9 @@ executables:
52
52
  extensions: []
53
53
  extra_rdoc_files: []
54
54
  files:
55
+ - .rspec
55
56
  - .gitignore
56
57
  - .gitmodules
57
- - .rspec
58
58
  - Gemfile
59
59
  - LICENSE
60
60
  - README.md
@@ -96,6 +96,8 @@ files:
96
96
  - NerdPursuit/questions/backticks_in_ruby.json
97
97
  - NerdPursuit/questions/base_object.json
98
98
  - NerdPursuit/questions/best_language.json
99
+ - NerdPursuit/questions/bind.json
100
+ - NerdPursuit/questions/bindtypesignature.json
99
101
  - NerdPursuit/questions/bitwise_and.json
100
102
  - NerdPursuit/questions/bitwise_or.json
101
103
  - NerdPursuit/questions/chrome_v8.json
@@ -146,6 +148,7 @@ files:
146
148
  - NerdPursuit/questions/kernel.json
147
149
  - NerdPursuit/questions/last_cmd_sub.json
148
150
  - NerdPursuit/questions/last_directory.json
151
+ - NerdPursuit/questions/laziness.json
149
152
  - NerdPursuit/questions/lazy.json
150
153
  - NerdPursuit/questions/list_comprehension_python.json
151
154
  - NerdPursuit/questions/map_parseInt.json
@@ -154,6 +157,9 @@ files:
154
157
  - NerdPursuit/questions/method_used_for_comparisions.json
155
158
  - NerdPursuit/questions/min_max_quantifier.json
156
159
  - NerdPursuit/questions/mixins_are_what.json
160
+ - NerdPursuit/questions/monads.json
161
+ - NerdPursuit/questions/monadsvsmonoids.json
162
+ - NerdPursuit/questions/monoids.json
157
163
  - NerdPursuit/questions/mutable_data_type.json
158
164
  - NerdPursuit/questions/name_of_python_module_rep.json
159
165
  - NerdPursuit/questions/negative_look_ahead.json
@@ -192,6 +198,8 @@ files:
192
198
  - NerdPursuit/questions/rake_about.json
193
199
  - NerdPursuit/questions/ranges_three_dots.json
194
200
  - NerdPursuit/questions/release_date.json
201
+ - NerdPursuit/questions/rest.json
202
+ - NerdPursuit/questions/rest_about.json
195
203
  - NerdPursuit/questions/return_value_or.json
196
204
  - NerdPursuit/questions/roses.json
197
205
  - NerdPursuit/questions/rspec_controller_render_views.json
@@ -205,7 +213,6 @@ files:
205
213
  - NerdPursuit/questions/strict_doctype.json
206
214
  - NerdPursuit/questions/string_clean_whitespace.json
207
215
  - NerdPursuit/questions/string_object_coercion_internals.json
208
- - NerdPursuit/questions/string_v_strings.h
209
216
  - NerdPursuit/questions/sum_things_up.json
210
217
  - NerdPursuit/questions/symbol_identity_01.json
211
218
  - NerdPursuit/questions/symbol_identity_02.json
@@ -262,7 +269,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
262
269
  version: '0'
263
270
  segments:
264
271
  - 0
265
- hash: -3068606542880087422
272
+ hash: -870043030186754183
266
273
  requirements: []
267
274
  rubyforge_project: nerd_quiz
268
275
  rubygems_version: 1.8.11
@@ -270,6 +277,7 @@ signing_key:
270
277
  specification_version: 3
271
278
  summary: A ruby gem which implements a command line interface to NerdPursuit questions
272
279
  test_files:
280
+ - .rspec
273
281
  - spec/nerd_quiz/question_spec.rb
274
282
  - spec/nerd_quiz/questions_spec.rb
275
283
  - spec/nerd_quiz/quiz_spec.rb
@@ -1,15 +0,0 @@
1
- {
2
- "question": {
3
- "sub_category": "C",
4
- "category": "programming",
5
- "created_at": "2012-03-15",
6
- "right_answer": "a1",
7
- "creator": "a2800276",
8
- "nerd_level": 1,
9
- "text": "Which of the following functions is NOT defined in `string.h`",
10
- "a1": "strncasecmp",
11
- "a2": "strncmp",
12
- "a3": "strncat",
13
- "a4": "memccpy"
14
- }
15
- }