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 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
@@ -0,0 +1,2 @@
1
+ ruby=ruby-1.9.3
2
+ ruby-gemset=randomer
@@ -1,3 +1,3 @@
1
1
  module Randomer
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
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
@@ -16,4 +16,5 @@ Gem::Specification.new do |gem|
16
16
  gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
17
17
  gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
18
18
  gem.require_paths = ["lib"]
19
+ gem.license = ""
19
20
  end
@@ -7,6 +7,7 @@ describe Randomer::Percent do
7
7
  :b => 1000,
8
8
  :c => 870,
9
9
  :e => 0,
10
+ 'd' => 10000,
10
11
  }
11
12
  end
12
13
 
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.2
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: 2012-09-16 00:00:00.000000000 Z
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.8.24
52
+ rubygems_version: 2.1.10
53
53
  signing_key:
54
- specification_version: 3
54
+ specification_version: 4
55
55
  summary: Write a gem summary
56
56
  test_files:
57
57
  - spec/randomer_percent_spec.rb