Pickaxe 0.4.2 → 0.4.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -5,7 +5,7 @@ require "active_support/all"
5
5
  $LOAD_PATH.unshift(File.expand_path(File.dirname(__FILE__)))
6
6
 
7
7
  module Pickaxe
8
- VERSION = "0.4.2"
8
+ VERSION = "0.4.3"
9
9
 
10
10
  class PickaxeError < StandardError
11
11
  attr_reader :status_code
@@ -8,7 +8,9 @@ module Pickaxe
8
8
  This is the end of this test and You can now jump back to
9
9
  any question and check (or change) Your answers.
10
10
 
11
- Hit [ENTER] to rate the test.
11
+ If You do not know how to jump back type `?' and press [ENTER].
12
+
13
+ Hit [ENTER] to rate the test and see Your incorrect answers.
12
14
  END_OF_TEST
13
15
 
14
16
  def initialize(paths, options = {})
@@ -24,6 +26,7 @@ END_OF_TEST
24
26
  @logger.formatter = lambda { |severity, time, progname, msg| msg.to_s + "\n" }
25
27
 
26
28
  @questions = @test.shuffled_questions
29
+ @questions_length = @questions.length.to_f
27
30
  @answers = Hash.new([])
28
31
  @started_at = Time.now
29
32
  @current_index = 0
@@ -79,7 +82,8 @@ END_OF_TEST
79
82
  if Main.options[:full_test] and @question.nil?
80
83
  Main.options[:full_test] = false
81
84
  Main.options[:force_show_answers] = true
82
-
85
+
86
+ @questions = @test.selected.select { |q| not q.correct?(@answers[q]) }
83
87
  @current_index = 0
84
88
  else
85
89
  @current_index += 1
@@ -136,7 +140,7 @@ END_OF_HELP
136
140
  protected
137
141
  def stat(name, color)
138
142
  value = @stats[name.to_s.downcase.to_sym]
139
- puts format("#{name.to_s.capitalize}: #{value} (%g%%)", value/@questions.length.to_f * 100).color(color)
143
+ puts format("#{name.to_s.capitalize}: #{value} (%g%%)", value/@questions_length * 100).color(color)
140
144
  end
141
145
  end
142
146
  end
@@ -175,12 +175,12 @@ module Pickaxe
175
175
  end
176
176
 
177
177
  class Answer < Struct.new(:content, :index, :correctness)
178
- RE = /^\s*(>>)?\s*(\?\?)?\s*\((\w+)\)\s*(.+)$/
178
+ RE = /^\s*(>+)?\s*(\?\?)?\s*\(?(\w+)\)\s*(.+)$/
179
179
  LINE_RE = /^\s*(\w+)/
180
180
 
181
181
  def self.parse(file, lines)
182
182
  m = RE.match(lines.shift)
183
- Answer.new(m[m.size-1].strip + " " + lines.collect(&:strip).join(" "), m[m.size-2].strip, m[1] == ">>")
183
+ Answer.new(m[4].strip + " " + lines.collect(&:strip).join(" "), m[3].strip, !m[1].nil?)
184
184
  end
185
185
 
186
186
  def to_s
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: Pickaxe
3
3
  version: !ruby/object:Gem::Version
4
- hash: 11
4
+ hash: 9
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 4
9
- - 2
10
- version: 0.4.2
9
+ - 3
10
+ version: 0.4.3
11
11
  platform: ruby
12
12
  authors:
13
13
  - Dawid Fatyga
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-12-01 00:00:00 +01:00
18
+ date: 2010-12-02 00:00:00 +01:00
19
19
  default_executable: bin/pickaxe
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency