rudil 1.0.0 → 1.0.2
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 +7 -0
- data/lib/rudil.rb +1 -1
- data/lib/rudil/die.rb +0 -1
- data/spec/die_spec.rb +2 -2
- metadata +29 -60
- data/History.txt +0 -10
- data/Manifest.txt +0 -15
- data/README.markdown +0 -117
- data/Rakefile +0 -20
- data/script/console +0 -10
- data/script/destroy +0 -14
- data/script/generate +0 -14
- data/spec/spec.opts +0 -1
- data/tasks/rspec.rake +0 -21
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 024529c80ceee4d6c3dd370bab2088179f71381b
|
4
|
+
data.tar.gz: 8373c702c0b53d01f405d8fca48444dadf7cc700
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 8c3dd40f4394a36bae05c5d8d7aeb6b7f07bf4f7c3cf6cd409a0497e89148bcfd4a7980ddacf9a7930767bff52200f3e33432e2a23dbba5474a6abb98658405f
|
7
|
+
data.tar.gz: f1442beb976b93bfb800dd57f288adf41114ce428eb476e73532fa833322685f4af17a48e3b95ba02a47304c1b201c58c6f4d027330de400b0dcd79f7181c4c4
|
data/lib/rudil.rb
CHANGED
data/lib/rudil/die.rb
CHANGED
@@ -4,7 +4,6 @@ module Rudil
|
|
4
4
|
unless sides >= 1 and sides <= 120
|
5
5
|
raise ArgumentError
|
6
6
|
# "120 sides should be enough for anybody."
|
7
|
-
# - sMAshdot
|
8
7
|
# Such a die would be an Hexakis Icosahedron, and I challenge
|
9
8
|
# anyone to build it.
|
10
9
|
# The biggest manufactured die to date has 100 sides and is
|
data/spec/die_spec.rb
CHANGED
@@ -58,14 +58,14 @@ describe Die do
|
|
58
58
|
|
59
59
|
it "should return the result after it has been thrown once" do
|
60
60
|
die = Die.new()
|
61
|
-
die.stub
|
61
|
+
die.stub(:throw_once).and_return(6)
|
62
62
|
throw = die.throw(1)
|
63
63
|
throw[0].should == 6
|
64
64
|
end
|
65
65
|
|
66
66
|
it "should return the result after it has been thrown any number of times" do
|
67
67
|
die = Die.new()
|
68
|
-
die.stub
|
68
|
+
die.stub(:throw_once).and_return(1,2,3,4,5,6)
|
69
69
|
throw = die.throw(6)
|
70
70
|
throw[0].should == 1
|
71
71
|
throw[5].should == 6
|
metadata
CHANGED
@@ -1,81 +1,50 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: rudil
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.2
|
5
5
|
platform: ruby
|
6
|
-
authors:
|
6
|
+
authors:
|
7
7
|
- Marc-Antonio Bisotti
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
name: hoe
|
17
|
-
type: :development
|
18
|
-
version_requirement:
|
19
|
-
version_requirements: !ruby/object:Gem::Requirement
|
20
|
-
requirements:
|
21
|
-
- - ">="
|
22
|
-
- !ruby/object:Gem::Version
|
23
|
-
version: 2.3.3
|
24
|
-
version:
|
25
|
-
description: Throw dice with any number of sides any number of times. Helps you to interpret the results.
|
26
|
-
email:
|
27
|
-
- mail@marc-antonio.de
|
11
|
+
date: 2015-04-11 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description: Throw dice with any number of sides any number of times. Helps you interpreting
|
14
|
+
the results.
|
15
|
+
email: mail@marc-antonio.de
|
28
16
|
executables: []
|
29
|
-
|
30
17
|
extensions: []
|
31
|
-
|
32
|
-
|
33
|
-
- History.txt
|
34
|
-
- Manifest.txt
|
35
|
-
files:
|
36
|
-
- History.txt
|
37
|
-
- Manifest.txt
|
38
|
-
- README.markdown
|
39
|
-
- Rakefile
|
18
|
+
extra_rdoc_files: []
|
19
|
+
files:
|
40
20
|
- lib/rudil.rb
|
41
21
|
- lib/rudil/die.rb
|
42
22
|
- lib/rudil/throw.rb
|
43
|
-
- script/console
|
44
|
-
- script/destroy
|
45
|
-
- script/generate
|
46
23
|
- spec/die_spec.rb
|
47
|
-
- spec/spec.opts
|
48
24
|
- spec/spec_helper.rb
|
49
25
|
- spec/throw_spec.rb
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
26
|
+
homepage: http://rubygems.org/gems/rudil
|
27
|
+
licenses:
|
28
|
+
- MIT
|
29
|
+
metadata: {}
|
55
30
|
post_install_message:
|
56
|
-
rdoc_options:
|
57
|
-
|
58
|
-
- README.markdown
|
59
|
-
require_paths:
|
31
|
+
rdoc_options: []
|
32
|
+
require_paths:
|
60
33
|
- lib
|
61
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
62
|
-
requirements:
|
34
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
35
|
+
requirements:
|
63
36
|
- - ">="
|
64
|
-
- !ruby/object:Gem::Version
|
65
|
-
version:
|
66
|
-
|
67
|
-
|
68
|
-
requirements:
|
37
|
+
- !ruby/object:Gem::Version
|
38
|
+
version: '0'
|
39
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
40
|
+
requirements:
|
69
41
|
- - ">="
|
70
|
-
- !ruby/object:Gem::Version
|
71
|
-
version:
|
72
|
-
version:
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: '0'
|
73
44
|
requirements: []
|
74
|
-
|
75
|
-
|
76
|
-
rubygems_version: 1.3.5
|
45
|
+
rubyforge_project:
|
46
|
+
rubygems_version: 2.2.2
|
77
47
|
signing_key:
|
78
|
-
specification_version:
|
79
|
-
summary: rudil is a dice library for the
|
48
|
+
specification_version: 4
|
49
|
+
summary: rudil is a dice library for the ruby programming language
|
80
50
|
test_files: []
|
81
|
-
|
data/History.txt
DELETED
data/Manifest.txt
DELETED
@@ -1,15 +0,0 @@
|
|
1
|
-
History.txt
|
2
|
-
Manifest.txt
|
3
|
-
README.markdown
|
4
|
-
Rakefile
|
5
|
-
lib/rudil.rb
|
6
|
-
lib/rudil/die.rb
|
7
|
-
lib/rudil/throw.rb
|
8
|
-
script/console
|
9
|
-
script/destroy
|
10
|
-
script/generate
|
11
|
-
spec/die_spec.rb
|
12
|
-
spec/spec.opts
|
13
|
-
spec/spec_helper.rb
|
14
|
-
spec/throw_spec.rb
|
15
|
-
tasks/rspec.rake
|
data/README.markdown
DELETED
@@ -1,117 +0,0 @@
|
|
1
|
-
rudil
|
2
|
-
=====
|
3
|
-
|
4
|
-
[rudil's homepage on github](http://github.com/sMAshdot/rudil)
|
5
|
-
|
6
|
-
DESCRIPTION
|
7
|
-
-----------
|
8
|
-
|
9
|
-
rudil is a dice library for the Ruby programming language.
|
10
|
-
|
11
|
-
FEATURES
|
12
|
-
--------
|
13
|
-
|
14
|
-
Roll dice with any number of sides.
|
15
|
-
Methods provided for single and multiple rolls.
|
16
|
-
Retrieve useful information about the rolls easily.
|
17
|
-
|
18
|
-
INSTALL
|
19
|
-
-------
|
20
|
-
|
21
|
-
Assuming you installed [Gemcutter](http://gemcutter.org), all you need to do is:
|
22
|
-
|
23
|
-
gem install rudil
|
24
|
-
|
25
|
-
SYNOPSIS
|
26
|
-
--------
|
27
|
-
|
28
|
-
### Creating a die
|
29
|
-
|
30
|
-
require 'rudil'
|
31
|
-
die = Rudil::Die.new
|
32
|
-
|
33
|
-
or
|
34
|
-
|
35
|
-
require 'rudil'
|
36
|
-
include Rudil
|
37
|
-
die = Die.new
|
38
|
-
|
39
|
-
The die will have 6 sides per default. If you want another number of sides,
|
40
|
-
pass it as a parameter to the constructor:
|
41
|
-
|
42
|
-
die = Die.new(20)
|
43
|
-
|
44
|
-
### Rolling the die
|
45
|
-
|
46
|
-
If you only need the result of a single throw, use the throw_once method:
|
47
|
-
|
48
|
-
die.throw_once
|
49
|
-
=> 3
|
50
|
-
|
51
|
-
The throw method will return an array containing any number of throws:
|
52
|
-
|
53
|
-
die.throw(5)
|
54
|
-
=> [6, 5, 3, 1, 3]
|
55
|
-
|
56
|
-
The die will be thrown once per default.
|
57
|
-
|
58
|
-
die.throw
|
59
|
-
=> [4]
|
60
|
-
|
61
|
-
### Analysing the results
|
62
|
-
|
63
|
-
A *Throw* is a subclass of array with a few convenience methods added.
|
64
|
-
To use it, collect the rolls in an instance of it:
|
65
|
-
|
66
|
-
throws = Throw.new( Die.new(20).throw(5) )
|
67
|
-
=> [3, 6, 16, 13, 18]
|
68
|
-
|
69
|
-
You can get information about
|
70
|
-
|
71
|
-
* the lowest and the highest roll
|
72
|
-
* the mean (floating point)
|
73
|
-
* the number of rolls above a certain value (or equal and above)
|
74
|
-
* the number of rolls below a certain value (or equal and below)
|
75
|
-
|
76
|
-
like this:
|
77
|
-
|
78
|
-
throws.lowest
|
79
|
-
=> 3
|
80
|
-
throws.highest
|
81
|
-
=> 18
|
82
|
-
throws.mean
|
83
|
-
=> 11.2
|
84
|
-
throws.above(13)
|
85
|
-
=> 2
|
86
|
-
throws.eq_or_above(13)
|
87
|
-
=> 3
|
88
|
-
throws.below 3
|
89
|
-
=> 0
|
90
|
-
throws.eq_or_below(3)
|
91
|
-
=> 1
|
92
|
-
|
93
|
-
LICENSE
|
94
|
-
-------
|
95
|
-
|
96
|
-
(The MIT License)
|
97
|
-
|
98
|
-
Copyright (c) 2009 Marc-Antonio Bisotti
|
99
|
-
|
100
|
-
Permission is hereby granted, free of charge, to any person obtaining
|
101
|
-
a copy of this software and associated documentation files (the
|
102
|
-
'Software'), to deal in the Software without restriction, including
|
103
|
-
without limitation the rights to use, copy, modify, merge, publish,
|
104
|
-
distribute, sublicense, and/or sell copies of the Software, and to
|
105
|
-
permit persons to whom the Software is furnished to do so, subject to
|
106
|
-
the following conditions:
|
107
|
-
|
108
|
-
The above copyright notice and this permission notice shall be
|
109
|
-
included in all copies or substantial portions of the Software.
|
110
|
-
|
111
|
-
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
112
|
-
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
113
|
-
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
114
|
-
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
115
|
-
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
116
|
-
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
117
|
-
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/Rakefile
DELETED
@@ -1,20 +0,0 @@
|
|
1
|
-
require 'rubygems'
|
2
|
-
gem 'hoe', '>= 2.1.0'
|
3
|
-
require 'hoe'
|
4
|
-
require 'fileutils'
|
5
|
-
require './lib/rudil'
|
6
|
-
|
7
|
-
Hoe.plugin :newgem
|
8
|
-
|
9
|
-
# Generate all the Rake tasks
|
10
|
-
# Run 'rake -T' to see list of generated tasks (from gem root directory)
|
11
|
-
$hoe = Hoe.spec 'rudil' do
|
12
|
-
self.developer 'Marc-Antonio Bisotti', 'mail@marc-antonio.de'
|
13
|
-
self.url = "http://github.com/sMAshdot/rudil"
|
14
|
-
self.summary = 'rudil is a dice library for the Ruby programming language.'
|
15
|
-
self.description = "Throw dice with any number of sides any number of times. Helps you to interpret the results."
|
16
|
-
self.readme_file = 'README.markdown'
|
17
|
-
end
|
18
|
-
|
19
|
-
require 'newgem/tasks'
|
20
|
-
Dir['tasks/**/*.rake'].each { |t| load t }
|
data/script/console
DELETED
@@ -1,10 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
# File: script/console
|
3
|
-
irb = RUBY_PLATFORM =~ /(:?mswin|mingw)/ ? 'irb.bat' : 'irb'
|
4
|
-
|
5
|
-
libs = " -r irb/completion"
|
6
|
-
# Perhaps use a console_lib to store any extra methods I may want available in the cosole
|
7
|
-
# libs << " -r #{File.dirname(__FILE__) + '/../lib/console_lib/console_logger.rb'}"
|
8
|
-
libs << " -r #{File.dirname(__FILE__) + '/../lib/rudil.rb'}"
|
9
|
-
puts "Loading rudil gem"
|
10
|
-
exec "#{irb} #{libs} --simple-prompt"
|
data/script/destroy
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
APP_ROOT = File.expand_path(File.join(File.dirname(__FILE__), '..'))
|
3
|
-
|
4
|
-
begin
|
5
|
-
require 'rubigen'
|
6
|
-
rescue LoadError
|
7
|
-
require 'rubygems'
|
8
|
-
require 'rubigen'
|
9
|
-
end
|
10
|
-
require 'rubigen/scripts/destroy'
|
11
|
-
|
12
|
-
ARGV.shift if ['--help', '-h'].include?(ARGV[0])
|
13
|
-
RubiGen::Base.use_component_sources! [:rubygems, :newgem, :newgem_theme, :test_unit]
|
14
|
-
RubiGen::Scripts::Destroy.new.run(ARGV)
|
data/script/generate
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
APP_ROOT = File.expand_path(File.join(File.dirname(__FILE__), '..'))
|
3
|
-
|
4
|
-
begin
|
5
|
-
require 'rubigen'
|
6
|
-
rescue LoadError
|
7
|
-
require 'rubygems'
|
8
|
-
require 'rubigen'
|
9
|
-
end
|
10
|
-
require 'rubigen/scripts/generate'
|
11
|
-
|
12
|
-
ARGV.shift if ['--help', '-h'].include?(ARGV[0])
|
13
|
-
RubiGen::Base.use_component_sources! [:rubygems, :newgem, :newgem_theme, :test_unit]
|
14
|
-
RubiGen::Scripts::Generate.new.run(ARGV)
|
data/spec/spec.opts
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
--colour
|
data/tasks/rspec.rake
DELETED
@@ -1,21 +0,0 @@
|
|
1
|
-
begin
|
2
|
-
require 'spec'
|
3
|
-
rescue LoadError
|
4
|
-
require 'rubygems' unless ENV['NO_RUBYGEMS']
|
5
|
-
require 'spec'
|
6
|
-
end
|
7
|
-
begin
|
8
|
-
require 'spec/rake/spectask'
|
9
|
-
rescue LoadError
|
10
|
-
puts <<-EOS
|
11
|
-
To use rspec for testing you must install rspec gem:
|
12
|
-
gem install rspec
|
13
|
-
EOS
|
14
|
-
exit(0)
|
15
|
-
end
|
16
|
-
|
17
|
-
desc "Run the specs under spec/models"
|
18
|
-
Spec::Rake::SpecTask.new do |t|
|
19
|
-
t.spec_opts = ['--options', "spec/spec.opts"]
|
20
|
-
t.spec_files = FileList['spec/**/*_spec.rb']
|
21
|
-
end
|