pickup 0.0.10 → 0.0.11
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 +2 -2
- data/lib/pickup.rb +1 -0
- data/lib/pickup/version.rb +1 -1
- data/spec/pickup/pickup_spec.rb +9 -1
- metadata +6 -6
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA1:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 1533293d956a1a06ceccf39a693f5718f1a2ead1
         | 
| 4 | 
            +
              data.tar.gz: bbc60771078bea080db4eab391d6a448d927a8de
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 38b74b2aae9cfb9ad5bd606a2332364786b74954f6718a94c6a2eed2ab263a83abff0f3ee2e944a06fb04a3dd064d6e0f9c99f06ce44c0f629185a818e541c0c
         | 
| 7 | 
            +
              data.tar.gz: 24789240487187618292db31609d935124523c5014fb568181782c0e8df45d87ec41a42964af3cfaab4e36b6ee846dd5f14fa41bb4dfa3f73f3d6a406e6e697d
         | 
    
        data/README.md
    CHANGED
    
    | @@ -1,6 +1,6 @@ | |
| 1 1 | 
             
            # Pickup
         | 
| 2 2 |  | 
| 3 | 
            -
            Pickup helps you to pick item from collection by  | 
| 3 | 
            +
            Pickup helps you to pick an item from a collection by its weight or probability.
         | 
| 4 4 |  | 
| 5 5 | 
             
            ## Installation
         | 
| 6 6 |  | 
| @@ -136,4 +136,4 @@ pickup.pick(1, key_func: name_func) | |
| 136 136 | 
             
            2. Create your feature branch (`git checkout -b my-new-feature`)
         | 
| 137 137 | 
             
            3. Commit your changes (`git commit -am 'Added some feature'`)
         | 
| 138 138 | 
             
            4. Push to the branch (`git push origin my-new-feature`)
         | 
| 139 | 
            -
            5. Create new Pull Request
         | 
| 139 | 
            +
            5. Create new Pull Request
         | 
    
        data/lib/pickup.rb
    CHANGED
    
    
    
        data/lib/pickup/version.rb
    CHANGED
    
    
    
        data/spec/pickup/pickup_spec.rb
    CHANGED
    
    | @@ -4,6 +4,7 @@ require 'ostruct' | |
| 4 4 | 
             
            require 'stringio'
         | 
| 5 5 |  | 
| 6 6 | 
             
            describe Pickup do
         | 
| 7 | 
            +
             | 
| 7 8 | 
             
              before do
         | 
| 8 9 | 
             
                @list = {
         | 
| 9 10 | 
             
                  "selmon"  => 1,     # 1
         | 
| @@ -49,7 +50,7 @@ describe Pickup do | |
| 49 50 | 
             
                  # Inspect the fake IO object for the deprecated warning.
         | 
| 50 51 | 
             
                  $stderr.rewind
         | 
| 51 52 | 
             
                  $stderr.string.chomp.must_equal("[DEPRECATED] Passing uniq as a boolean to MappedList's initialize method is deprecated. Please use the opts hash instead.")
         | 
| 52 | 
            -
             | 
| 53 | 
            +
             | 
| 53 54 | 
             
                  # Restore the original stderr.
         | 
| 54 55 | 
             
                  $stderr = orig_stderr
         | 
| 55 56 | 
             
                end
         | 
| @@ -116,4 +117,11 @@ describe Pickup do | |
| 116 117 | 
             
              it "should take 5 fish (using custom weight function)" do
         | 
| 117 118 | 
             
                @pickup3.pick(5, key_func: @key_func, weight_func: @weight_func).size.must_equal 5
         | 
| 118 119 | 
             
              end
         | 
| 120 | 
            +
             | 
| 121 | 
            +
              let(:list) { { "foo" => 0 } }
         | 
| 122 | 
            +
              let(:pickup) { Pickup.new(list) }
         | 
| 123 | 
            +
             | 
| 124 | 
            +
              it "should not devide by zero" do
         | 
| 125 | 
            +
                pickup.pick(1)
         | 
| 126 | 
            +
              end
         | 
| 119 127 | 
             
            end
         | 
    
        metadata
    CHANGED
    
    | @@ -1,14 +1,14 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: pickup
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 0.0. | 
| 4 | 
            +
              version: 0.0.11
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - fl00r
         | 
| 8 8 | 
             
            autorequire: 
         | 
| 9 9 | 
             
            bindir: bin
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date:  | 
| 11 | 
            +
            date: 2015-03-16 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies: []
         | 
| 13 13 | 
             
            description: Pickup helps you to pick item from collection by it's weight/probability
         | 
| 14 14 | 
             
            email:
         | 
| @@ -17,7 +17,7 @@ executables: [] | |
| 17 17 | 
             
            extensions: []
         | 
| 18 18 | 
             
            extra_rdoc_files: []
         | 
| 19 19 | 
             
            files:
         | 
| 20 | 
            -
            - .gitignore
         | 
| 20 | 
            +
            - ".gitignore"
         | 
| 21 21 | 
             
            - Gemfile
         | 
| 22 22 | 
             
            - LICENSE
         | 
| 23 23 | 
             
            - README.md
         | 
| @@ -37,17 +37,17 @@ require_paths: | |
| 37 37 | 
             
            - lib
         | 
| 38 38 | 
             
            required_ruby_version: !ruby/object:Gem::Requirement
         | 
| 39 39 | 
             
              requirements:
         | 
| 40 | 
            -
              - -  | 
| 40 | 
            +
              - - ">="
         | 
| 41 41 | 
             
                - !ruby/object:Gem::Version
         | 
| 42 42 | 
             
                  version: '1.9'
         | 
| 43 43 | 
             
            required_rubygems_version: !ruby/object:Gem::Requirement
         | 
| 44 44 | 
             
              requirements:
         | 
| 45 | 
            -
              - -  | 
| 45 | 
            +
              - - ">="
         | 
| 46 46 | 
             
                - !ruby/object:Gem::Version
         | 
| 47 47 | 
             
                  version: '0'
         | 
| 48 48 | 
             
            requirements: []
         | 
| 49 49 | 
             
            rubyforge_project: 
         | 
| 50 | 
            -
            rubygems_version: 2. | 
| 50 | 
            +
            rubygems_version: 2.2.2
         | 
| 51 51 | 
             
            signing_key: 
         | 
| 52 52 | 
             
            specification_version: 4
         | 
| 53 53 | 
             
            summary: Pickup helps you to pick item from collection by it's weight/probability
         |