dice_roll 0.0.1 → 0.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.
- data/.gitignore +4 -0
- data/Gemfile +4 -0
- data/Rakefile +2 -0
- data/dice_roll.gemspec +21 -0
- data/lib/dice_roll.rb +3 -0
- data/lib/dice_roll/version.rb +3 -0
- metadata +10 -5
- data/lib/dice.rb +0 -32
data/.gitignore
ADDED
data/Gemfile
ADDED
data/Rakefile
ADDED
data/dice_roll.gemspec
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
3
|
+
require "dice_roll/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |s|
|
6
|
+
s.name = "dice_roll"
|
7
|
+
s.version = DiceRoll::VERSION
|
8
|
+
s.platform = Gem::Platform::RUBY
|
9
|
+
s.authors = ["Stuart Hanscombe"]
|
10
|
+
s.email = ["hanscs1969@yahoo.co.uk"]
|
11
|
+
s.homepage = ""
|
12
|
+
s.summary = %q{Simple dice throwing code}
|
13
|
+
s.description = %q{A library that throws some dice and gives you the result, you can choose the number of dice and the number of sides the dice have}
|
14
|
+
|
15
|
+
s.rubyforge_project = "dice_roll"
|
16
|
+
|
17
|
+
s.files = `git ls-files`.split("\n")
|
18
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
19
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
20
|
+
s.require_paths = ["lib"]
|
21
|
+
end
|
data/lib/dice_roll.rb
ADDED
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: dice_roll
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.0.
|
5
|
+
version: 0.0.2
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Stuart Hanscombe
|
@@ -14,7 +14,7 @@ date: 2011-03-19 00:00:00 +01:00
|
|
14
14
|
default_executable:
|
15
15
|
dependencies: []
|
16
16
|
|
17
|
-
description: A library that throws some dice and gives you the result
|
17
|
+
description: A library that throws some dice and gives you the result, you can choose the number of dice and the number of sides the dice have
|
18
18
|
email:
|
19
19
|
- hanscs1969@yahoo.co.uk
|
20
20
|
executables: []
|
@@ -24,9 +24,14 @@ extensions: []
|
|
24
24
|
extra_rdoc_files: []
|
25
25
|
|
26
26
|
files:
|
27
|
-
-
|
27
|
+
- .gitignore
|
28
|
+
- Gemfile
|
29
|
+
- Rakefile
|
30
|
+
- dice_roll.gemspec
|
31
|
+
- lib/dice_roll.rb
|
32
|
+
- lib/dice_roll/version.rb
|
28
33
|
has_rdoc: true
|
29
|
-
homepage:
|
34
|
+
homepage: ""
|
30
35
|
licenses: []
|
31
36
|
|
32
37
|
post_install_message:
|
@@ -48,7 +53,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
48
53
|
version: "0"
|
49
54
|
requirements: []
|
50
55
|
|
51
|
-
rubyforge_project:
|
56
|
+
rubyforge_project: dice_roll
|
52
57
|
rubygems_version: 1.5.3
|
53
58
|
signing_key:
|
54
59
|
specification_version: 3
|
data/lib/dice.rb
DELETED
@@ -1,32 +0,0 @@
|
|
1
|
-
module Dice
|
2
|
-
|
3
|
-
class Roller
|
4
|
-
|
5
|
-
attr_accessor :result, :total
|
6
|
-
|
7
|
-
def initialize(no_of_dice=1,sides=6)
|
8
|
-
@no_of_dice = no_of_dice
|
9
|
-
@sides = sides
|
10
|
-
@result = []
|
11
|
-
end
|
12
|
-
|
13
|
-
def result
|
14
|
-
@result
|
15
|
-
end
|
16
|
-
|
17
|
-
def throw
|
18
|
-
@result.clear
|
19
|
-
@no_of_dice.times do |die|
|
20
|
-
@result << rand(@sides) + 1
|
21
|
-
end
|
22
|
-
@result
|
23
|
-
end
|
24
|
-
|
25
|
-
def total
|
26
|
-
@result.inject(:+)
|
27
|
-
end
|
28
|
-
|
29
|
-
end
|
30
|
-
|
31
|
-
|
32
|
-
end
|