fair_dice_roll 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: abeeaaff4d43298885e81c8ecc564f041bb29c0c
4
+ data.tar.gz: d45c38a43375dc1922c347b9035f9a7ba7544d9b
5
+ SHA512:
6
+ metadata.gz: 58a2c26bd575eca5df13ab78c165e1570a78127dbb4e20bb84e48c470e90bb79e33ce5a117eded2fbed6de9ef76bada9758d2c092a79d65eb34593138920a680
7
+ data.tar.gz: decdec2c0ba71a4ce674075f77fe9520900a5f47be5845f89b29e0d22d52c5e0e14b12785ddc7067c727af53a3a442e3963607f40e8493b1570db41a8077e42c
data/.gitignore ADDED
@@ -0,0 +1,22 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
18
+ *.bundle
19
+ *.so
20
+ *.o
21
+ *.a
22
+ mkmf.log
data/.rspec ADDED
@@ -0,0 +1,4 @@
1
+ --color
2
+ --format documentation
3
+ --order random
4
+ --require spec_helper
data/.travis.yml ADDED
@@ -0,0 +1,20 @@
1
+ branches:
2
+ only:
3
+ - master
4
+ env:
5
+ global:
6
+ secure: | # CODECLIMATE_REPO_TOKEN
7
+ mWbGKP4AUdfjjK0Vx8UqZVA/5ERfXxQ0sz+asOriGq8GkMmIh9fkpV1cto5I
8
+ PD4AOgJiYBh17XZ1igxm8Khwhw39Jf2QMGSW+WuMI6h94CUdwHxe4IN+0mkm
9
+ x7I/BnsJ8kRSDYNxxH3XM6ktGBICaAnWrvAkeOUV7enhYqN6e+s=
10
+ language: ruby
11
+ matrix:
12
+ allow_failures:
13
+ - rvm: 1.9.3
14
+ - rvm: ruby-head
15
+ rvm:
16
+ - 1.9.3
17
+ - "2.0"
18
+ - "2.1"
19
+ - ruby-head
20
+ script: bundle exec rspec
data/Gemfile ADDED
@@ -0,0 +1,8 @@
1
+ source "https://rubygems.org"
2
+
3
+ gemspec
4
+
5
+ group :test do
6
+ gem "codeclimate-test-reporter", require: false
7
+ gem "rspec", "~> 3.0"
8
+ end
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2014 Steve Richert
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,37 @@
1
+ # FairDiceRoll 🎲
2
+
3
+ Finally. Truly random numbers in Ruby.
4
+
5
+ [![Gem Version](https://img.shields.io/gem/v/fair_dice_roll.svg?style=flat)](http://rubygems.org/gems/fair_dice_roll)
6
+ [![Build Status](https://img.shields.io/travis/laserlemon/fair_dice_roll/master.svg?style=flat)](https://travis-ci.org/laserlemon/fair_dice_roll)
7
+ [![Code Climate](https://img.shields.io/codeclimate/github/laserlemon/fair_dice_roll.svg?style=flat)](https://codeclimate.com/github/laserlemon/fair_dice_roll)
8
+ [![Code Coverage](http://img.shields.io/codeclimate/coverage/github/laserlemon/fair_dice_roll.svg?style=flat)](https://codeclimate.com/github/laserlemon/fair_dice_roll)
9
+ [![Dependency Status](https://img.shields.io/gemnasium/laserlemon/fair_dice_roll.svg?style=flat)](https://gemnasium.com/laserlemon/fair_dice_roll)
10
+
11
+ ## Installation
12
+
13
+ 1. Add to your application's Gemfile:
14
+
15
+ ```ruby
16
+ gem "fair_dice_roll"
17
+ ```
18
+
19
+ 2. Execute:
20
+
21
+ ```
22
+ $ bundle install
23
+ ```
24
+
25
+ 3. Bask in the glory of ultimate randomness!
26
+
27
+ ## Contributing
28
+
29
+ 1. [Fork](https://github.com/laserlemon/fair_dice_roll/fork) it.
30
+ 2. Roll a die… fairly.
31
+ 3. [Record](https://github.com/laserlemon/fair_dice_roll/blob/master/lib/fair_dice_roll.rb#L4) your result.
32
+ 4. Submit a [pull request](https://github.com/laserlemon/fair_dice_roll/pulls).
33
+ 5. Please include photographic [evidence](http://imgur.com/XT16hzE) of your roll.
34
+
35
+ ## Thanks
36
+
37
+ Thank you to [XKCD](http://xkcd.com) for the [inspiration](http://xkcd.com/221/).
data/Rakefile ADDED
@@ -0,0 +1,6 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task default: :spec
@@ -0,0 +1,20 @@
1
+ # encoding: utf-8
2
+
3
+ Gem::Specification.new do |spec|
4
+ spec.name = "fair_dice_roll"
5
+ spec.version = "1.0.0"
6
+
7
+ spec.author = "Steve Richert"
8
+ spec.email = "steve.richert@gmail.com"
9
+ spec.summary = "Guaranteed to be random."
10
+ spec.description = "Chosen by fair dice roll. Guaranteed to be random."
11
+ spec.homepage = "https://github.com/laserlemon/fair_dice_roll"
12
+ spec.license = "MIT"
13
+
14
+ spec.files = `git ls-files -z`.split("\x0")
15
+ spec.executables = spec.files.grep(/^bin/) { |f| File.basename(f) }
16
+ spec.test_files = spec.files.grep(/^spec/)
17
+
18
+ spec.add_development_dependency "bundler", "~> 1.6"
19
+ spec.add_development_dependency "rake", "~> 10.3"
20
+ end
@@ -0,0 +1,32 @@
1
+ require "securerandom"
2
+
3
+ module FairDiceRoll
4
+ RANDOM_NUMBER = 4 # chosen by fair dice roll.
5
+ # guaranteed to be random.
6
+ end
7
+
8
+ module Kernel
9
+ def self.rand(*)
10
+ FairDiceRoll::RANDOM_NUMBER
11
+ end
12
+
13
+ def rand(*)
14
+ FairDiceRoll::RANDOM_NUMBER
15
+ end
16
+ end
17
+
18
+ class Random
19
+ def self.rand(*)
20
+ FairDiceRoll::RANDOM_NUMBER
21
+ end
22
+
23
+ def rand(*)
24
+ FairDiceRoll::RANDOM_NUMBER
25
+ end
26
+ end
27
+
28
+ module SecureRandom
29
+ def self.random_number(*)
30
+ FairDiceRoll::RANDOM_NUMBER
31
+ end
32
+ end
@@ -0,0 +1,45 @@
1
+ describe FairDiceRoll do
2
+ let(:random_number) { FairDiceRoll::RANDOM_NUMBER }
3
+
4
+ describe "#rand" do
5
+ it "is guaranteed to be random" do
6
+ expect(rand).to eq(random_number)
7
+ expect(rand(3)).to eq(random_number)
8
+ end
9
+ end
10
+
11
+ describe Kernel do
12
+ describe "#rand" do
13
+ it "is guaranteed to be random" do
14
+ expect(Kernel.rand).to eq(random_number)
15
+ expect(Kernel.rand(3)).to eq(random_number)
16
+ end
17
+ end
18
+ end
19
+
20
+ describe Random do
21
+ describe ".rand" do
22
+ it "is guaranteed to be random" do
23
+ expect(Random.rand).to eq(random_number)
24
+ expect(Random.rand(3)).to eq(random_number)
25
+ end
26
+ end
27
+
28
+ describe "#rand" do
29
+ it "is guaranteed to be random" do
30
+ random = Random.new
31
+ expect(random.rand).to eq(random_number)
32
+ expect(random.rand(3)).to eq(random_number)
33
+ end
34
+ end
35
+ end
36
+
37
+ describe SecureRandom do
38
+ describe "#random_number" do
39
+ it "is guaranteed to be random" do
40
+ expect(SecureRandom.random_number).to eq(random_number)
41
+ expect(SecureRandom.random_number(3)).to eq(random_number)
42
+ end
43
+ end
44
+ end
45
+ end
@@ -0,0 +1,6 @@
1
+ if ENV["CODECLIMATE_REPO_TOKEN"]
2
+ require "codeclimate-test-reporter"
3
+ CodeClimate::TestReporter.start
4
+ end
5
+
6
+ require "fair_dice_roll"
metadata ADDED
@@ -0,0 +1,84 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: fair_dice_roll
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Steve Richert
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-07-09 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.6'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.6'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '10.3'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '10.3'
41
+ description: Chosen by fair dice roll. Guaranteed to be random.
42
+ email: steve.richert@gmail.com
43
+ executables: []
44
+ extensions: []
45
+ extra_rdoc_files: []
46
+ files:
47
+ - ".gitignore"
48
+ - ".rspec"
49
+ - ".travis.yml"
50
+ - Gemfile
51
+ - LICENSE.txt
52
+ - README.md
53
+ - Rakefile
54
+ - fair_dice_roll.gemspec
55
+ - lib/fair_dice_roll.rb
56
+ - spec/fair_dice_roll_spec.rb
57
+ - spec/spec_helper.rb
58
+ homepage: https://github.com/laserlemon/fair_dice_roll
59
+ licenses:
60
+ - MIT
61
+ metadata: {}
62
+ post_install_message:
63
+ rdoc_options: []
64
+ require_paths:
65
+ - lib
66
+ required_ruby_version: !ruby/object:Gem::Requirement
67
+ requirements:
68
+ - - ">="
69
+ - !ruby/object:Gem::Version
70
+ version: '0'
71
+ required_rubygems_version: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ requirements: []
77
+ rubyforge_project:
78
+ rubygems_version: 2.2.2
79
+ signing_key:
80
+ specification_version: 4
81
+ summary: Guaranteed to be random.
82
+ test_files:
83
+ - spec/fair_dice_roll_spec.rb
84
+ - spec/spec_helper.rb