progressor 0.1.1 → 0.1.2
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/lib/progressor/limited_sequence.rb +9 -1
 - data/lib/progressor/unlimited_sequence.rb +8 -1
 - data/lib/progressor/version.rb +1 -1
 - metadata +8 -8
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA256:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: 54e39588afa295d9501f32e4a183834d030b536cb902fbc133be2e61d2b97745
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 5732a7f82cd05f0ced057785595d2d4724264ddef570c69fca086823b76318fd
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: e9339fc8632bdd3b0d1c0ab47d5c95d987e6db3f5383f59541511341735c105ebce68a6544eed20a0614f8ee12974d91f9fc65dfe58f4d5e662d96a02746092a
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: 5b58b596f4596bccccb352ec2c8ec6949573ad898677b228fcd43073e8b141d561c397b428d5f16dfe53dd7134e2fdb430f2be51c1a0013a1537e95f98d724ae
         
     | 
| 
         @@ -61,7 +61,7 @@ class Progressor 
     | 
|
| 
       61 
61 
     | 
    
         
             
                end
         
     | 
| 
       62 
62 
     | 
    
         | 
| 
       63 
63 
     | 
    
         
             
                # Outputs a textual representation of the current state of the
         
     | 
| 
       64 
     | 
    
         
            -
                #  
     | 
| 
      
 64 
     | 
    
         
            +
                # LimitedSequence. Shows:
         
     | 
| 
       65 
65 
     | 
    
         
             
                #
         
     | 
| 
       66 
66 
     | 
    
         
             
                # - the current number of iterations and the total count
         
     | 
| 
       67 
67 
     | 
    
         
             
                # - completion level in percentage
         
     | 
| 
         @@ -117,6 +117,14 @@ class Progressor 
     | 
|
| 
       117 
117 
     | 
    
         
             
                  remaining_time.round(2)
         
     | 
| 
       118 
118 
     | 
    
         
             
                end
         
     | 
| 
       119 
119 
     | 
    
         | 
| 
      
 120 
     | 
    
         
            +
                # Returns the time since the object was instantiated, formatted like all
         
     | 
| 
      
 121 
     | 
    
         
            +
                # the other durations. Useful for a final message to compare initial
         
     | 
| 
      
 122 
     | 
    
         
            +
                # estimation to actual elapsed time.
         
     | 
| 
      
 123 
     | 
    
         
            +
                #
         
     | 
| 
      
 124 
     | 
    
         
            +
                def elapsed_time
         
     | 
| 
      
 125 
     | 
    
         
            +
                  format_time(Time.now - @start_time)
         
     | 
| 
      
 126 
     | 
    
         
            +
                end
         
     | 
| 
      
 127 
     | 
    
         
            +
             
     | 
| 
       120 
128 
     | 
    
         
             
                private
         
     | 
| 
       121 
129 
     | 
    
         | 
| 
       122 
130 
     | 
    
         
             
                def average(collection)
         
     | 
| 
         @@ -71,7 +71,7 @@ class Progressor 
     | 
|
| 
       71 
71 
     | 
    
         | 
| 
       72 
72 
     | 
    
         
             
                  [
         
     | 
| 
       73 
73 
     | 
    
         
             
                    "#{@current + 1}",
         
     | 
| 
       74 
     | 
    
         
            -
                    "t: #{ 
     | 
| 
      
 74 
     | 
    
         
            +
                    "t: #{elapsed_time}",
         
     | 
| 
       75 
75 
     | 
    
         
             
                    "t/i: #{format_time(per_iteration)}",
         
     | 
| 
       76 
76 
     | 
    
         
             
                  ].join(', ')
         
     | 
| 
       77 
77 
     | 
    
         
             
                end
         
     | 
| 
         @@ -95,6 +95,13 @@ class Progressor 
     | 
|
| 
       95 
95 
     | 
    
         
             
                  # No estimation possible
         
     | 
| 
       96 
96 
     | 
    
         
             
                end
         
     | 
| 
       97 
97 
     | 
    
         | 
| 
      
 98 
     | 
    
         
            +
                # Returns the time since the object was instantiated, formatted like all
         
     | 
| 
      
 99 
     | 
    
         
            +
                # the other durations.
         
     | 
| 
      
 100 
     | 
    
         
            +
                #
         
     | 
| 
      
 101 
     | 
    
         
            +
                def elapsed_time
         
     | 
| 
      
 102 
     | 
    
         
            +
                  format_time(Time.now - @start_time)
         
     | 
| 
      
 103 
     | 
    
         
            +
                end
         
     | 
| 
      
 104 
     | 
    
         
            +
             
     | 
| 
       98 
105 
     | 
    
         
             
                private
         
     | 
| 
       99 
106 
     | 
    
         | 
| 
       100 
107 
     | 
    
         
             
                def average(collection)
         
     | 
    
        data/lib/progressor/version.rb
    CHANGED
    
    
    
        metadata
    CHANGED
    
    | 
         @@ -1,14 +1,14 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: progressor
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 0.1. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 0.1.2
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - Andrew Radev
         
     | 
| 
       8 
     | 
    
         
            -
            autorequire: 
     | 
| 
      
 8 
     | 
    
         
            +
            autorequire:
         
     | 
| 
       9 
9 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       10 
10 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       11 
     | 
    
         
            -
            date:  
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2022-04-03 00:00:00.000000000 Z
         
     | 
| 
       12 
12 
     | 
    
         
             
            dependencies:
         
     | 
| 
       13 
13 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       14 
14 
     | 
    
         
             
              name: rake
         
     | 
| 
         @@ -16,14 +16,14 @@ dependencies: 
     | 
|
| 
       16 
16 
     | 
    
         
             
                requirements:
         
     | 
| 
       17 
17 
     | 
    
         
             
                - - "~>"
         
     | 
| 
       18 
18 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       19 
     | 
    
         
            -
                    version:  
     | 
| 
      
 19 
     | 
    
         
            +
                    version: 12.3.3
         
     | 
| 
       20 
20 
     | 
    
         
             
              type: :development
         
     | 
| 
       21 
21 
     | 
    
         
             
              prerelease: false
         
     | 
| 
       22 
22 
     | 
    
         
             
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
       23 
23 
     | 
    
         
             
                requirements:
         
     | 
| 
       24 
24 
     | 
    
         
             
                - - "~>"
         
     | 
| 
       25 
25 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       26 
     | 
    
         
            -
                    version:  
     | 
| 
      
 26 
     | 
    
         
            +
                    version: 12.3.3
         
     | 
| 
       27 
27 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       28 
28 
     | 
    
         
             
              name: rspec
         
     | 
| 
       29 
29 
     | 
    
         
             
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
         @@ -74,7 +74,7 @@ homepage: https://github.com/AndrewRadev/progressor 
     | 
|
| 
       74 
74 
     | 
    
         
             
            licenses:
         
     | 
| 
       75 
75 
     | 
    
         
             
            - MIT
         
     | 
| 
       76 
76 
     | 
    
         
             
            metadata: {}
         
     | 
| 
       77 
     | 
    
         
            -
            post_install_message: 
     | 
| 
      
 77 
     | 
    
         
            +
            post_install_message:
         
     | 
| 
       78 
78 
     | 
    
         
             
            rdoc_options: []
         
     | 
| 
       79 
79 
     | 
    
         
             
            require_paths:
         
     | 
| 
       80 
80 
     | 
    
         
             
            - lib
         
     | 
| 
         @@ -89,8 +89,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement 
     | 
|
| 
       89 
89 
     | 
    
         
             
                - !ruby/object:Gem::Version
         
     | 
| 
       90 
90 
     | 
    
         
             
                  version: '0'
         
     | 
| 
       91 
91 
     | 
    
         
             
            requirements: []
         
     | 
| 
       92 
     | 
    
         
            -
            rubygems_version: 3. 
     | 
| 
       93 
     | 
    
         
            -
            signing_key: 
     | 
| 
      
 92 
     | 
    
         
            +
            rubygems_version: 3.1.6
         
     | 
| 
      
 93 
     | 
    
         
            +
            signing_key:
         
     | 
| 
       94 
94 
     | 
    
         
             
            specification_version: 4
         
     | 
| 
       95 
95 
     | 
    
         
             
            summary: Measure iterations in a long-running task
         
     | 
| 
       96 
96 
     | 
    
         
             
            test_files: []
         
     |