randomevent 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6155df4b607a596457e2e9fa7236aacb9266cde4
4
- data.tar.gz: 2141bde33c24e95967e952e72ab6003bbd23f79c
3
+ metadata.gz: aa1759b914c351f474e5ff60648733701b71046b
4
+ data.tar.gz: 5fafa21adac7d4cbce80d7f3a4f08b796b7c851b
5
5
  SHA512:
6
- metadata.gz: 547f343ea0d6b03b9e67a5e06dea3668a5841e7b453a31ab5cf09cd96b98d584c28c0c0bf2eea40df9c71a471736ecd51f312bc7a2a723bf60191f9170a601f6
7
- data.tar.gz: 7e228e419e526a3acd49de84290c6c356090bc42a0aeea056380c78b3744bf820889d8be0494da9892c3f2be457930e191e0ee30f83aafda5cd6ea05d041d252
6
+ metadata.gz: d504d115ad2c8867e68b0d562040c7fc68c764bf538d29bb9a4a61451dc10a1e3d9b2f5c5a2cfc473d3d91091c8522050dfa3e6fe916c0caa375527e87bcf777
7
+ data.tar.gz: 9152d634dd1c28284a3d60972ba38f179b928e883df451d6e1391ad767b227512d6acb081ff04d63c0b0bd2492ab41a6971dac94e5f6af0e492aae11b06ffae6
data/README.md CHANGED
@@ -1,5 +1,26 @@
1
- # Randomevent
1
+ # RandomEvent
2
2
 
3
+ RandomEvent is a DSL that makes it easy to create a set of blocks such that a single one in the set will be executed, based off the probability assigned to each one.
4
+
5
+ Example:
6
+
7
+ # half of the time it will output hello, 25% of the time goodbye
8
+ # and 25 % of the time the default will be executed
9
+ RandomEvent.new do |r|
10
+ r.chance 0.50 do
11
+ puts 'hello'
12
+ end
13
+
14
+ r.chance 0.25 do
15
+ puts 'goodbye'
16
+ end
17
+
18
+ # this is optional, there is no need to have a default case
19
+ # if it is not requried
20
+ r.chance :else do
21
+ puts '-'
22
+ end
23
+ end
3
24
 
4
25
  ## Installation
5
26
 
@@ -17,10 +38,6 @@ Or install it yourself as:
17
38
 
18
39
  $ gem install randomevent
19
40
 
20
- ## Usage
21
-
22
-
23
-
24
41
  ## Development
25
42
 
26
43
  After checking out the repo, run `bin/setup` to install dependencies. Then, run `bin/console` for an interactive prompt that will allow you to experiment.
@@ -1,3 +1,3 @@
1
1
  module Randomevent
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
@@ -9,7 +9,7 @@ Gem::Specification.new do |spec|
9
9
  spec.authors = ["Nathan Reed"]
10
10
  spec.email = ["reednj@gmail.com"]
11
11
 
12
- spec.summary = %q{A Gem to execute a block from a set based on a certain probability}
12
+ spec.summary = %q{A Gem to conditionally execute a block based on a certain probability}
13
13
  spec.homepage = "http://github.com/reednj/randomevent"
14
14
  spec.license = "MIT"
15
15
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: randomevent
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nathan Reed
@@ -93,6 +93,6 @@ rubyforge_project:
93
93
  rubygems_version: 2.4.5
94
94
  signing_key:
95
95
  specification_version: 4
96
- summary: A Gem to execute a block from a set based on a certain probability
96
+ summary: A Gem to conditionally execute a block based on a certain probability
97
97
  test_files:
98
98
  - test/randomevent_test.rb