Pickaxe 0.4.2 → 0.4.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.
- data/lib/pickaxe.rb +1 -1
 - data/lib/pickaxe/main.rb +7 -3
 - data/lib/pickaxe/test.rb +2 -2
 - metadata +4 -4
 
    
        data/lib/pickaxe.rb
    CHANGED
    
    
    
        data/lib/pickaxe/main.rb
    CHANGED
    
    | 
         @@ -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 
     | 
    
         
            -
             
     | 
| 
      
 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/@ 
     | 
| 
      
 143 
     | 
    
         
            +
            			puts format("#{name.to_s.capitalize}: #{value} (%g%%)", value/@questions_length * 100).color(color)
         
     | 
| 
       140 
144 
     | 
    
         
             
            		end
         
     | 
| 
       141 
145 
     | 
    
         
             
            	end
         
     | 
| 
       142 
146 
     | 
    
         
             
            end
         
     | 
    
        data/lib/pickaxe/test.rb
    CHANGED
    
    | 
         @@ -175,12 +175,12 @@ module Pickaxe 
     | 
|
| 
       175 
175 
     | 
    
         
             
            	end
         
     | 
| 
       176 
176 
     | 
    
         | 
| 
       177 
177 
     | 
    
         
             
            	class Answer < Struct.new(:content, :index, :correctness)
         
     | 
| 
       178 
     | 
    
         
            -
            		RE = /^\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[ 
     | 
| 
      
 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:  
     | 
| 
      
 4 
     | 
    
         
            +
              hash: 9
         
     | 
| 
       5 
5 
     | 
    
         
             
              prerelease: false
         
     | 
| 
       6 
6 
     | 
    
         
             
              segments: 
         
     | 
| 
       7 
7 
     | 
    
         
             
              - 0
         
     | 
| 
       8 
8 
     | 
    
         
             
              - 4
         
     | 
| 
       9 
     | 
    
         
            -
              -  
     | 
| 
       10 
     | 
    
         
            -
              version: 0.4. 
     | 
| 
      
 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- 
     | 
| 
      
 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 
         
     |