roulette-wheel-selection 1.1.0 → 1.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +10 -10
- data/CHANGELOG.md +13 -10
- data/Gemfile +10 -11
- data/README.md +80 -80
- data/Rakefile +10 -10
- data/bin/console +14 -14
- data/bin/setup +8 -8
- data/lib/roulette-wheel-selection.rb +65 -65
- data/lib/roulette-wheel-selection/version.rb +3 -3
- data/roulette-wheel-selection.gemspec +40 -33
- metadata +19 -15
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 66ccb012e8b2ce721476518c3e875e00cce5abe5165f3c778f0a2c25613a8bab
|
4
|
+
data.tar.gz: 7a6fad1d5b9939f9b0ec6590f53d2cc7803482df334db643838eefc49482c92e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 90612a5b11f1a4cfc34b9d5569baf5c85d9ab8fc4f0cfd08a04fae516f8dc3b5814f88a645867f14ef55b962d4b05840b5301adc5124d383bfceae17f777b0c0
|
7
|
+
data.tar.gz: 9828ad74a66ed5d9e53baf52be4241d4c4d5f7950db014ed4805da4cc5de64e8f969f8c8a7b5f59c3b7312e6ad1c1c9c07c08998d549e781e106a731a296f936
|
data/.gitignore
CHANGED
@@ -1,10 +1,10 @@
|
|
1
|
-
/.bundle/
|
2
|
-
/.yardoc
|
3
|
-
/Gemfile.lock
|
4
|
-
/_yardoc/
|
5
|
-
/coverage/
|
6
|
-
/doc/
|
7
|
-
/pkg/
|
8
|
-
/spec/reports/
|
9
|
-
/tmp/
|
10
|
-
|
1
|
+
/.bundle/
|
2
|
+
/.yardoc
|
3
|
+
/Gemfile.lock
|
4
|
+
/_yardoc/
|
5
|
+
/coverage/
|
6
|
+
/doc/
|
7
|
+
/pkg/
|
8
|
+
/spec/reports/
|
9
|
+
/tmp/
|
10
|
+
|
data/CHANGELOG.md
CHANGED
@@ -1,10 +1,13 @@
|
|
1
|
-
## Change Log
|
2
|
-
|
3
|
-
### [v1.0
|
4
|
-
- [#
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
- [#
|
9
|
-
|
10
|
-
|
1
|
+
## Change Log
|
2
|
+
|
3
|
+
### [v1.1.0](https://github.com/khiav223577/roulette-wheel-selection/compare/v1.0.2...v1.1.0) 2019/01/28
|
4
|
+
- [#7](https://github.com/khiav223577/roulette-wheel-selection/pull/7) Behavior should be like Array#sample (@khiav223577)
|
5
|
+
|
6
|
+
### [v1.0.2](https://github.com/khiav223577/roulette-wheel-selection/compare/v1.0.1...v1.0.2) 2019/01/22
|
7
|
+
- [#5](https://github.com/khiav223577/roulette-wheel-selection/pull/5) Support sampling N elements (@khiav223577)
|
8
|
+
- [#4](https://github.com/khiav223577/roulette-wheel-selection/pull/4) Fix: broken test cases after bundler 2.0 was released (@khiav223577)
|
9
|
+
|
10
|
+
### [v1.0.1](https://github.com/khiav223577/roulette-wheel-selection/compare/v1.0.0...v1.0.1) 2018/07/17
|
11
|
+
- [#3](https://github.com/khiav223577/roulette-wheel-selection/pull/3) Fix: zero weight objects should be ignored (@khiav223577)
|
12
|
+
- [#2](https://github.com/khiav223577/roulette-wheel-selection/pull/2) Fix: should return nil if input is empty (@khiav223577)
|
13
|
+
- [#1](https://github.com/khiav223577/roulette-wheel-selection/pull/1) try using new test reporter (@khiav223577)
|
data/Gemfile
CHANGED
@@ -1,11 +1,10 @@
|
|
1
|
-
source 'https://rubygems.org'
|
2
|
-
|
3
|
-
# Specify your gem's dependencies in rails_or.gemspec
|
4
|
-
|
5
|
-
group :test do
|
6
|
-
gem "simplecov"
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
1
|
+
source 'https://rubygems.org'
|
2
|
+
|
3
|
+
# Specify your gem's dependencies in rails_or.gemspec
|
4
|
+
|
5
|
+
group :test do
|
6
|
+
gem "simplecov"
|
7
|
+
end
|
8
|
+
|
9
|
+
gemspec :path => "./"
|
10
|
+
|
data/README.md
CHANGED
@@ -1,80 +1,80 @@
|
|
1
|
-
[![Gem Version](https://img.shields.io/gem/v/roulette-wheel-selection.svg?style=flat)](https://rubygems.org/gems/roulette-wheel-selection)
|
2
|
-
[![Build Status](https://travis-ci.org/khiav223577/roulette-wheel-selection.svg?branch=master)](https://travis-ci.org/khiav223577/roulette-wheel-selection)
|
3
|
-
[![RubyGems](http://img.shields.io/gem/dt/roulette-wheel-selection.svg?style=flat)](https://rubygems.org/gems/roulette-wheel-selection)
|
4
|
-
[![Code Climate](https://codeclimate.com/github/khiav223577/roulette-wheel-selection/badges/gpa.svg)](https://codeclimate.com/github/khiav223577/roulette-wheel-selection)
|
5
|
-
[![Test Coverage](https://codeclimate.com/github/khiav223577/roulette-wheel-selection/badges/coverage.svg)](https://codeclimate.com/github/khiav223577/roulette-wheel-selection/coverage)
|
6
|
-
|
7
|
-
# roulette-wheel-selection
|
8
|
-
|
9
|
-
|
10
|
-
## Installation
|
11
|
-
|
12
|
-
Add this line to your application's Gemfile:
|
13
|
-
|
14
|
-
```ruby
|
15
|
-
gem 'roulette-wheel-selection'
|
16
|
-
```
|
17
|
-
|
18
|
-
And then execute:
|
19
|
-
|
20
|
-
$ bundle
|
21
|
-
|
22
|
-
Or install it yourself as:
|
23
|
-
|
24
|
-
$ gem install roulette-wheel-selection
|
25
|
-
|
26
|
-
## Usage
|
27
|
-
|
28
|
-
### require the library
|
29
|
-
```rb
|
30
|
-
require 'roulette-wheel-selection'
|
31
|
-
```
|
32
|
-
|
33
|
-
### Hash format
|
34
|
-
|
35
|
-
```rb
|
36
|
-
RouletteWheelSelection.sample(
|
37
|
-
'cola' => 40,
|
38
|
-
'sprite' => 20,
|
39
|
-
'fanta' => 30,
|
40
|
-
'wine' => 40,
|
41
|
-
)
|
42
|
-
# => 'cola'
|
43
|
-
```
|
44
|
-
|
45
|
-
#### sample n random elements
|
46
|
-
|
47
|
-
```rb
|
48
|
-
roulette = RouletteWheelSelection.new('ps4' => 50, 'switch' => 40, 'xbox' => 30)
|
49
|
-
roulette.sample(3)
|
50
|
-
# => ['ps4', 'switch', 'xbox']
|
51
|
-
```
|
52
|
-
|
53
|
-
### Array format
|
54
|
-
|
55
|
-
```rb
|
56
|
-
drinks = [
|
57
|
-
{ name: 'cola', weight: 40 },
|
58
|
-
{ name: 'sprite', weight: 20 },
|
59
|
-
{ name: 'fanta', weight: 30 },
|
60
|
-
{ name: 'wine', weight: 40 },
|
61
|
-
]
|
62
|
-
RouletteWheelSelection.sample(drinks, :weight)
|
63
|
-
# => { name: 'cola', weight: 40 }
|
64
|
-
```
|
65
|
-
|
66
|
-
## Development
|
67
|
-
|
68
|
-
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
69
|
-
|
70
|
-
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
71
|
-
|
72
|
-
## Contributing
|
73
|
-
|
74
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/khiav223577/roulette-wheel-selection. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
75
|
-
|
76
|
-
|
77
|
-
## License
|
78
|
-
|
79
|
-
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
80
|
-
|
1
|
+
[![Gem Version](https://img.shields.io/gem/v/roulette-wheel-selection.svg?style=flat)](https://rubygems.org/gems/roulette-wheel-selection)
|
2
|
+
[![Build Status](https://travis-ci.org/khiav223577/roulette-wheel-selection.svg?branch=master)](https://travis-ci.org/khiav223577/roulette-wheel-selection)
|
3
|
+
[![RubyGems](http://img.shields.io/gem/dt/roulette-wheel-selection.svg?style=flat)](https://rubygems.org/gems/roulette-wheel-selection)
|
4
|
+
[![Code Climate](https://codeclimate.com/github/khiav223577/roulette-wheel-selection/badges/gpa.svg)](https://codeclimate.com/github/khiav223577/roulette-wheel-selection)
|
5
|
+
[![Test Coverage](https://codeclimate.com/github/khiav223577/roulette-wheel-selection/badges/coverage.svg)](https://codeclimate.com/github/khiav223577/roulette-wheel-selection/coverage)
|
6
|
+
|
7
|
+
# roulette-wheel-selection
|
8
|
+
|
9
|
+
|
10
|
+
## Installation
|
11
|
+
|
12
|
+
Add this line to your application's Gemfile:
|
13
|
+
|
14
|
+
```ruby
|
15
|
+
gem 'roulette-wheel-selection'
|
16
|
+
```
|
17
|
+
|
18
|
+
And then execute:
|
19
|
+
|
20
|
+
$ bundle
|
21
|
+
|
22
|
+
Or install it yourself as:
|
23
|
+
|
24
|
+
$ gem install roulette-wheel-selection
|
25
|
+
|
26
|
+
## Usage
|
27
|
+
|
28
|
+
### require the library
|
29
|
+
```rb
|
30
|
+
require 'roulette-wheel-selection'
|
31
|
+
```
|
32
|
+
|
33
|
+
### Hash format
|
34
|
+
|
35
|
+
```rb
|
36
|
+
RouletteWheelSelection.sample(
|
37
|
+
'cola' => 40,
|
38
|
+
'sprite' => 20,
|
39
|
+
'fanta' => 30,
|
40
|
+
'wine' => 40,
|
41
|
+
)
|
42
|
+
# => 'cola'
|
43
|
+
```
|
44
|
+
|
45
|
+
#### sample n random elements
|
46
|
+
|
47
|
+
```rb
|
48
|
+
roulette = RouletteWheelSelection.new('ps4' => 50, 'switch' => 40, 'xbox' => 30)
|
49
|
+
roulette.sample(3)
|
50
|
+
# => ['ps4', 'switch', 'xbox']
|
51
|
+
```
|
52
|
+
|
53
|
+
### Array format
|
54
|
+
|
55
|
+
```rb
|
56
|
+
drinks = [
|
57
|
+
{ name: 'cola', weight: 40 },
|
58
|
+
{ name: 'sprite', weight: 20 },
|
59
|
+
{ name: 'fanta', weight: 30 },
|
60
|
+
{ name: 'wine', weight: 40 },
|
61
|
+
]
|
62
|
+
RouletteWheelSelection.sample(drinks, :weight)
|
63
|
+
# => { name: 'cola', weight: 40 }
|
64
|
+
```
|
65
|
+
|
66
|
+
## Development
|
67
|
+
|
68
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
69
|
+
|
70
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
71
|
+
|
72
|
+
## Contributing
|
73
|
+
|
74
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/khiav223577/roulette-wheel-selection. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
75
|
+
|
76
|
+
|
77
|
+
## License
|
78
|
+
|
79
|
+
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
80
|
+
|
data/Rakefile
CHANGED
@@ -1,10 +1,10 @@
|
|
1
|
-
require "bundler/gem_tasks"
|
2
|
-
require "rake/testtask"
|
3
|
-
|
4
|
-
Rake::TestTask.new(:test) do |t|
|
5
|
-
t.libs << "test"
|
6
|
-
t.libs << "lib"
|
7
|
-
t.test_files = FileList['test/**/*_test.rb']
|
8
|
-
end
|
9
|
-
|
10
|
-
task :default => :test
|
1
|
+
require "bundler/gem_tasks"
|
2
|
+
require "rake/testtask"
|
3
|
+
|
4
|
+
Rake::TestTask.new(:test) do |t|
|
5
|
+
t.libs << "test"
|
6
|
+
t.libs << "lib"
|
7
|
+
t.test_files = FileList['test/**/*_test.rb']
|
8
|
+
end
|
9
|
+
|
10
|
+
task :default => :test
|
data/bin/console
CHANGED
@@ -1,14 +1,14 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
require "bundler/setup"
|
4
|
-
require "roulette-wheel-selection"
|
5
|
-
|
6
|
-
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
-
# with your gem easier. You can also use a different console, if you like.
|
8
|
-
|
9
|
-
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
-
# require "pry"
|
11
|
-
# Pry.start
|
12
|
-
|
13
|
-
require "irb"
|
14
|
-
IRB.start
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "roulette-wheel-selection"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start
|
data/bin/setup
CHANGED
@@ -1,8 +1,8 @@
|
|
1
|
-
#!/usr/bin/env bash
|
2
|
-
set -euo pipefail
|
3
|
-
IFS=$'\n\t'
|
4
|
-
set -vx
|
5
|
-
|
6
|
-
bundle install --gemfile=gemfiles/3.2.gemfile
|
7
|
-
|
8
|
-
# Do any other automated setup that you need to do here
|
1
|
+
#!/usr/bin/env bash
|
2
|
+
set -euo pipefail
|
3
|
+
IFS=$'\n\t'
|
4
|
+
set -vx
|
5
|
+
|
6
|
+
bundle install --gemfile=gemfiles/3.2.gemfile
|
7
|
+
|
8
|
+
# Do any other automated setup that you need to do here
|
@@ -1,65 +1,65 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require "roulette-wheel-selection/version"
|
4
|
-
|
5
|
-
class RouletteWheelSelection
|
6
|
-
NOT_SET = Object.new
|
7
|
-
|
8
|
-
class << self
|
9
|
-
def sample(*args)
|
10
|
-
object = args.first
|
11
|
-
case object
|
12
|
-
when Array ; sample_from_array(*args)
|
13
|
-
when Hash ; sample_from_hash(*args)
|
14
|
-
else ; fail "Unsupported type: #{object.class}"
|
15
|
-
end
|
16
|
-
end
|
17
|
-
|
18
|
-
private
|
19
|
-
|
20
|
-
def sample_from_array(array, key)
|
21
|
-
hash = array.map{|v| [v, v[key]] }.to_h
|
22
|
-
return sample_from_hash(hash)
|
23
|
-
end
|
24
|
-
|
25
|
-
def sample_from_hash(hash)
|
26
|
-
RouletteWheelSelection.new(hash).sample
|
27
|
-
end
|
28
|
-
end
|
29
|
-
|
30
|
-
def initialize(hash)
|
31
|
-
@hash = hash
|
32
|
-
@total_rate = hash.values.inject(
|
33
|
-
end
|
34
|
-
|
35
|
-
def sample(num = NOT_SET)
|
36
|
-
return if @total_rate == 0
|
37
|
-
return sample_an_object(@total_rate, @hash) if num == NOT_SET
|
38
|
-
return if num < 1
|
39
|
-
return sample_n_objects(num) if num > 1
|
40
|
-
return [sample_an_object(@total_rate, @hash)]
|
41
|
-
end
|
42
|
-
|
43
|
-
private
|
44
|
-
|
45
|
-
def sample_n_objects(num)
|
46
|
-
hash = @hash.clone
|
47
|
-
total_rate = @total_rate
|
48
|
-
num = total_rate if num > total_rate
|
49
|
-
return Array.new(num) do
|
50
|
-
obj = sample_an_object(total_rate, hash)
|
51
|
-
hash[obj] -= 1
|
52
|
-
total_rate -= 1
|
53
|
-
next obj
|
54
|
-
end
|
55
|
-
end
|
56
|
-
|
57
|
-
def sample_an_object(total_rate, hash)
|
58
|
-
random_seed = rand(total_rate)
|
59
|
-
hash.each do |obj, rate|
|
60
|
-
return obj if random_seed < rate
|
61
|
-
random_seed -= rate
|
62
|
-
end
|
63
|
-
end
|
64
|
-
end
|
65
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "roulette-wheel-selection/version"
|
4
|
+
|
5
|
+
class RouletteWheelSelection
|
6
|
+
NOT_SET = Object.new
|
7
|
+
|
8
|
+
class << self
|
9
|
+
def sample(*args)
|
10
|
+
object = args.first
|
11
|
+
case object
|
12
|
+
when Array ; sample_from_array(*args)
|
13
|
+
when Hash ; sample_from_hash(*args)
|
14
|
+
else ; fail "Unsupported type: #{object.class}"
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
private
|
19
|
+
|
20
|
+
def sample_from_array(array, key)
|
21
|
+
hash = array.map{|v| [v, v[key]] }.to_h
|
22
|
+
return sample_from_hash(hash)
|
23
|
+
end
|
24
|
+
|
25
|
+
def sample_from_hash(hash)
|
26
|
+
RouletteWheelSelection.new(hash).sample
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
def initialize(hash)
|
31
|
+
@hash = hash
|
32
|
+
@total_rate = hash.values.inject(0, :+)
|
33
|
+
end
|
34
|
+
|
35
|
+
def sample(num = NOT_SET)
|
36
|
+
return if @total_rate == 0
|
37
|
+
return sample_an_object(@total_rate, @hash) if num == NOT_SET
|
38
|
+
return if num < 1
|
39
|
+
return sample_n_objects(num) if num > 1
|
40
|
+
return [sample_an_object(@total_rate, @hash)]
|
41
|
+
end
|
42
|
+
|
43
|
+
private
|
44
|
+
|
45
|
+
def sample_n_objects(num)
|
46
|
+
hash = @hash.clone
|
47
|
+
total_rate = @total_rate
|
48
|
+
num = total_rate if num > total_rate
|
49
|
+
return Array.new(num) do
|
50
|
+
obj = sample_an_object(total_rate, hash)
|
51
|
+
hash[obj] -= 1
|
52
|
+
total_rate -= 1
|
53
|
+
next obj
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
def sample_an_object(total_rate, hash)
|
58
|
+
random_seed = rand(total_rate)
|
59
|
+
hash.each do |obj, rate|
|
60
|
+
return obj if random_seed < rate
|
61
|
+
random_seed -= rate
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
@@ -1,3 +1,3 @@
|
|
1
|
-
class RouletteWheelSelection
|
2
|
-
VERSION =
|
3
|
-
end
|
1
|
+
class RouletteWheelSelection
|
2
|
+
VERSION = '1.1.1'
|
3
|
+
end
|
@@ -1,33 +1,40 @@
|
|
1
|
-
# coding: utf-8
|
2
|
-
lib = File.expand_path('../lib', __FILE__)
|
3
|
-
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
-
require 'roulette-wheel-selection/version'
|
5
|
-
|
6
|
-
Gem::Specification.new do |spec|
|
7
|
-
spec.name = "roulette-wheel-selection"
|
8
|
-
spec.version = RouletteWheelSelection::VERSION
|
9
|
-
spec.authors = ["khiav reoy"]
|
10
|
-
spec.email = ["mrtmrt15xn@yahoo.com.tw"]
|
11
|
-
|
12
|
-
spec.summary = %q{}
|
13
|
-
spec.description = %q{}
|
14
|
-
spec.homepage = "https://github.com/khiav223577/roulette-wheel-selection"
|
15
|
-
spec.license = "MIT"
|
16
|
-
|
17
|
-
# Prevent pushing this gem to RubyGems.org by setting 'allowed_push_host', or
|
18
|
-
# delete this section to allow pushing this gem to any host.
|
19
|
-
#if spec.respond_to?(:metadata)
|
20
|
-
# spec.metadata['allowed_push_host'] = "TODO: Set to 'http://mygemserver.com'"
|
21
|
-
#else
|
22
|
-
# raise "RubyGems 2.0 or newer is required to protect against public gem pushes."
|
23
|
-
#end
|
24
|
-
|
25
|
-
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
26
|
-
spec.bindir = "exe"
|
27
|
-
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
28
|
-
spec.require_paths = ["lib"]
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'roulette-wheel-selection/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "roulette-wheel-selection"
|
8
|
+
spec.version = RouletteWheelSelection::VERSION
|
9
|
+
spec.authors = ["khiav reoy"]
|
10
|
+
spec.email = ["mrtmrt15xn@yahoo.com.tw"]
|
11
|
+
|
12
|
+
spec.summary = %q{Provide an algorithm allowing you to do weighted sampling.}
|
13
|
+
spec.description = %q{Provide an algorithm allowing you to do weighted sampling.}
|
14
|
+
spec.homepage = "https://github.com/khiav223577/roulette-wheel-selection"
|
15
|
+
spec.license = "MIT"
|
16
|
+
|
17
|
+
# Prevent pushing this gem to RubyGems.org by setting 'allowed_push_host', or
|
18
|
+
# delete this section to allow pushing this gem to any host.
|
19
|
+
#if spec.respond_to?(:metadata)
|
20
|
+
# spec.metadata['allowed_push_host'] = "TODO: Set to 'http://mygemserver.com'"
|
21
|
+
#else
|
22
|
+
# raise "RubyGems 2.0 or newer is required to protect against public gem pushes."
|
23
|
+
#end
|
24
|
+
|
25
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
26
|
+
spec.bindir = "exe"
|
27
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
28
|
+
spec.require_paths = ["lib"]
|
29
|
+
spec.metadata = {
|
30
|
+
'homepage_uri' => 'https://github.com/khiav223577/roulette-wheel-selection',
|
31
|
+
'changelog_uri' => 'https://github.com/khiav223577/roulette-wheel-selection/blob/master/ruby/CHANGELOG.md',
|
32
|
+
'source_code_uri' => 'https://github.com/khiav223577/roulette-wheel-selection',
|
33
|
+
'documentation_uri' => 'http://www.rubydoc.info/gems/roulette-wheel-selection',
|
34
|
+
'bug_tracker_uri' => 'https://github.com/khiav223577/roulette-wheel-selection/issues',
|
35
|
+
}
|
36
|
+
|
37
|
+
spec.add_development_dependency 'bundler', '>= 1.17', '< 3.x'
|
38
|
+
spec.add_development_dependency 'rake'
|
39
|
+
spec.add_development_dependency 'minitest'
|
40
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: roulette-wheel-selection
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- khiav reoy
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-08-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -34,31 +34,31 @@ dependencies:
|
|
34
34
|
name: rake
|
35
35
|
requirement: !ruby/object:Gem::Requirement
|
36
36
|
requirements:
|
37
|
-
- - "
|
37
|
+
- - ">="
|
38
38
|
- !ruby/object:Gem::Version
|
39
|
-
version: '
|
39
|
+
version: '0'
|
40
40
|
type: :development
|
41
41
|
prerelease: false
|
42
42
|
version_requirements: !ruby/object:Gem::Requirement
|
43
43
|
requirements:
|
44
|
-
- - "
|
44
|
+
- - ">="
|
45
45
|
- !ruby/object:Gem::Version
|
46
|
-
version: '
|
46
|
+
version: '0'
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: minitest
|
49
49
|
requirement: !ruby/object:Gem::Requirement
|
50
50
|
requirements:
|
51
|
-
- - "
|
51
|
+
- - ">="
|
52
52
|
- !ruby/object:Gem::Version
|
53
|
-
version: '
|
53
|
+
version: '0'
|
54
54
|
type: :development
|
55
55
|
prerelease: false
|
56
56
|
version_requirements: !ruby/object:Gem::Requirement
|
57
57
|
requirements:
|
58
|
-
- - "
|
58
|
+
- - ">="
|
59
59
|
- !ruby/object:Gem::Version
|
60
|
-
version: '
|
61
|
-
description:
|
60
|
+
version: '0'
|
61
|
+
description: Provide an algorithm allowing you to do weighted sampling.
|
62
62
|
email:
|
63
63
|
- mrtmrt15xn@yahoo.com.tw
|
64
64
|
executables: []
|
@@ -78,7 +78,12 @@ files:
|
|
78
78
|
homepage: https://github.com/khiav223577/roulette-wheel-selection
|
79
79
|
licenses:
|
80
80
|
- MIT
|
81
|
-
metadata:
|
81
|
+
metadata:
|
82
|
+
homepage_uri: https://github.com/khiav223577/roulette-wheel-selection
|
83
|
+
changelog_uri: https://github.com/khiav223577/roulette-wheel-selection/blob/master/ruby/CHANGELOG.md
|
84
|
+
source_code_uri: https://github.com/khiav223577/roulette-wheel-selection
|
85
|
+
documentation_uri: http://www.rubydoc.info/gems/roulette-wheel-selection
|
86
|
+
bug_tracker_uri: https://github.com/khiav223577/roulette-wheel-selection/issues
|
82
87
|
post_install_message:
|
83
88
|
rdoc_options: []
|
84
89
|
require_paths:
|
@@ -94,9 +99,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
94
99
|
- !ruby/object:Gem::Version
|
95
100
|
version: '0'
|
96
101
|
requirements: []
|
97
|
-
|
98
|
-
rubygems_version: 2.7.6
|
102
|
+
rubygems_version: 3.0.3
|
99
103
|
signing_key:
|
100
104
|
specification_version: 4
|
101
|
-
summary:
|
105
|
+
summary: Provide an algorithm allowing you to do weighted sampling.
|
102
106
|
test_files: []
|