randomer 0.0.2 → 0.0.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.
- checksums.yaml +15 -0
- data/.versions.conf +2 -0
- data/lib/randomer/version.rb +1 -1
- data/lib/randomer.rb +2 -2
- data/randomer.gemspec +1 -0
- data/spec/randomer_percent_spec.rb +1 -0
- metadata +8 -8
checksums.yaml
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
---
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
NWMxNTZjOTRjNjdhZTM0ZDQ3MTIyMWM5MzVhYWFjOTMxY2Y3ZDQyYw==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
NzRjODIyMWE0ZjViODkyYjRkYTYwMGVjMTFjMDgzNTdkYWRkODgzNw==
|
7
|
+
SHA512:
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
YTFiMGQ4MGVlYWFlOTYyMjA5OWU0YzlhNDdjNzFlNDFjM2IyNWQ0Zjg5OTcz
|
10
|
+
NDU4ODFjMTBmMWZlOWU1NDc4MTNhYTAwMDY4NTlkYjhlZWI5NDE2N2VlMDEy
|
11
|
+
YjJmNTEyNjdmOGZlZTdhNWUxODJkYWJkMjM0YWZlM2MzNzY4YzY=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
YjYwZTQzNmY5MTIwODE3MDdiYjQyMGRkZDYxM2VlOThjN2M0MjdmMjM2NTM5
|
14
|
+
Mjk4NmNkM2MyYmNmMWI3NWQ0YWUzMThmYjEwY2Q5ZTc1OTZkMGU0ZmY4Yzg0
|
15
|
+
YWRjMjUwZTA4N2UyZDJmN2QxZGMyNzgzMGQ2YTU2NTIyYWU5ZDU=
|
data/.versions.conf
ADDED
data/lib/randomer/version.rb
CHANGED
data/lib/randomer.rb
CHANGED
@@ -60,7 +60,7 @@ module Randomer
|
|
60
60
|
class Percent
|
61
61
|
class << self
|
62
62
|
##
|
63
|
-
# 根据一个hash中value指定的权重随机获取一个Symbol
|
63
|
+
# 根据一个hash中value指定的权重随机获取一个Symbol或String
|
64
64
|
#
|
65
65
|
# [params] Hash hash
|
66
66
|
#
|
@@ -77,7 +77,7 @@ module Randomer
|
|
77
77
|
interval = []
|
78
78
|
keys = []
|
79
79
|
hash.each do |key, value|
|
80
|
-
return false unless key.is_a? Symbol
|
80
|
+
return false unless key.is_a? Symbol or key.is_a? String
|
81
81
|
return false unless value.is_a? Integer
|
82
82
|
|
83
83
|
interval << (sum_value...(sum_value += value))
|
data/randomer.gemspec
CHANGED
metadata
CHANGED
@@ -1,15 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: randomer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
5
|
-
prerelease:
|
4
|
+
version: 0.0.3
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Zhuang Sirui
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
11
|
+
date: 2013-12-24 00:00:00.000000000 Z
|
13
12
|
dependencies: []
|
14
13
|
description: A gem for random everything
|
15
14
|
email:
|
@@ -19,6 +18,7 @@ extensions: []
|
|
19
18
|
extra_rdoc_files: []
|
20
19
|
files:
|
21
20
|
- .gitignore
|
21
|
+
- .versions.conf
|
22
22
|
- Gemfile
|
23
23
|
- LICENSE.txt
|
24
24
|
- README.markdown
|
@@ -30,28 +30,28 @@ files:
|
|
30
30
|
- spec/randomer_ranger_spec.rb
|
31
31
|
- spec/spec_helper.rb
|
32
32
|
homepage: https://github.com/siriuszhuang/Randomer
|
33
|
-
licenses:
|
33
|
+
licenses:
|
34
|
+
- ''
|
35
|
+
metadata: {}
|
34
36
|
post_install_message:
|
35
37
|
rdoc_options: []
|
36
38
|
require_paths:
|
37
39
|
- lib
|
38
40
|
required_ruby_version: !ruby/object:Gem::Requirement
|
39
|
-
none: false
|
40
41
|
requirements:
|
41
42
|
- - ! '>='
|
42
43
|
- !ruby/object:Gem::Version
|
43
44
|
version: '0'
|
44
45
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
45
|
-
none: false
|
46
46
|
requirements:
|
47
47
|
- - ! '>='
|
48
48
|
- !ruby/object:Gem::Version
|
49
49
|
version: '0'
|
50
50
|
requirements: []
|
51
51
|
rubyforge_project:
|
52
|
-
rubygems_version: 1.
|
52
|
+
rubygems_version: 2.1.10
|
53
53
|
signing_key:
|
54
|
-
specification_version:
|
54
|
+
specification_version: 4
|
55
55
|
summary: Write a gem summary
|
56
56
|
test_files:
|
57
57
|
- spec/randomer_percent_spec.rb
|