easy_dice 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +9 -6
- data/easy_dice.gemspec +4 -1
- data/lib/easy_dice/dice.rb +3 -1
- data/lib/easy_dice/version.rb +21 -0
- data/test/dice_test.rb +0 -8
- data/test/easy_dice_test.rb +0 -2
- data/test/helper.rb +1 -0
- metadata +17 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c6eb06318a0da597b05fcdb96fd03dbf2cf460c1
|
4
|
+
data.tar.gz: 4e6cdf8d904a9450a81193f953d1356595d49a54
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f4e4ca65b82bf3c9e0ea71f7e958dc727318e6aa2fdae991b9d6334a55d195c622416960220b55dfb9a373663935b02759a1ead911f60cbbdaeb7845b1481c1a
|
7
|
+
data.tar.gz: 639a9edd19b55f0f56600b49a6b8cfb87d09c7a7083bb792fc615332509deaee045970f473c995b468f51f99d1838c4a0f6437b7b84662e8c17a607708c28f6b
|
data/README.md
CHANGED
@@ -1,10 +1,11 @@
|
|
1
|
-
# easy_dice [![Build Status](https://travis-ci.org/komidore64/easy_dice.png?branch=master)](https://travis-ci.org/komidore64/easy_dice)
|
1
|
+
# easy_dice [![Build Status](https://travis-ci.org/komidore64/easy_dice.png?branch=master)](https://travis-ci.org/komidore64/easy_dice) [![Gem Version](https://badge.fury.io/rb/easy_dice.png)](http://rubygems.org/gems/easy_dice)
|
2
2
|
|
3
3
|
super simple gem for rolling polyhedral dice
|
4
4
|
|
5
5
|
## todo
|
6
6
|
|
7
|
-
-
|
7
|
+
- help-output for `roll` executable
|
8
|
+
- rdoc
|
8
9
|
|
9
10
|
## usage
|
10
11
|
|
@@ -32,12 +33,14 @@ irb> (12.d(6) + 10).roll
|
|
32
33
|
|
33
34
|
3. `easy_dice` can give you a little bit of miscellaneous information
|
34
35
|
```ruby
|
35
|
-
irb>
|
36
|
+
irb> d = 1.d(6) + 1.d(8)
|
37
|
+
=> #<Dice:0x00 ... >
|
38
|
+
irb> d.min # what's the smallest number that can be rolled?
|
36
39
|
=> 2
|
37
|
-
irb>
|
40
|
+
irb> d.max # what's the largest number that can be rolled?
|
38
41
|
=> 14
|
39
|
-
irb > puts
|
40
|
-
|
42
|
+
irb > puts d # "i forgot what dice i was going to roll"
|
43
|
+
1d6 + 1d8
|
41
44
|
=> nil
|
42
45
|
```
|
43
46
|
|
data/easy_dice.gemspec
CHANGED
@@ -14,9 +14,11 @@
|
|
14
14
|
# You should have received a copy of the GNU General Public License
|
15
15
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
16
16
|
|
17
|
+
require './lib/easy_dice/version'
|
18
|
+
|
17
19
|
Gem::Specification.new do |s|
|
18
20
|
s.name = "easy_dice"
|
19
|
-
s.version =
|
21
|
+
s.version = EasyDice::VERSION
|
20
22
|
s.authors = ["Adam Price"]
|
21
23
|
s.email = ["komidore64@gmail.com"]
|
22
24
|
s.homepage = "http://rubygems.org/gems/easy_dice"
|
@@ -31,4 +33,5 @@ Gem::Specification.new do |s|
|
|
31
33
|
s.add_development_dependency("rake", "~>10.1")
|
32
34
|
s.add_development_dependency("minitest", "~>4.3")
|
33
35
|
s.add_development_dependency("simplecov", "~>0.7")
|
36
|
+
s.add_development_dependency("debugger")
|
34
37
|
end
|
data/lib/easy_dice/dice.rb
CHANGED
@@ -16,6 +16,8 @@
|
|
16
16
|
|
17
17
|
class Dice
|
18
18
|
|
19
|
+
attr_reader :count, :sides, :parent, :child
|
20
|
+
|
19
21
|
def initialize(count, sides = 1)
|
20
22
|
@count, @sides = count, sides
|
21
23
|
end
|
@@ -56,7 +58,7 @@ class Dice
|
|
56
58
|
|
57
59
|
protected
|
58
60
|
|
59
|
-
|
61
|
+
attr_writer :parent, :child
|
60
62
|
|
61
63
|
def top
|
62
64
|
return @parent.nil? ? self : @parent.top
|
@@ -0,0 +1,21 @@
|
|
1
|
+
#
|
2
|
+
# Copyright (C) 2013 Adam Price (komidore64 at gmail dot com)
|
3
|
+
#
|
4
|
+
# This program is free software: you can redistribute it and/or modify
|
5
|
+
# it under the terms of the GNU General Public License as published by
|
6
|
+
# the Free Software Foundation, either version 3 of the License, or
|
7
|
+
# (at your option) any later version.
|
8
|
+
#
|
9
|
+
# This program is distributed in the hope that it will be useful,
|
10
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
11
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
12
|
+
# GNU General Public License for more details.
|
13
|
+
#
|
14
|
+
# You should have received a copy of the GNU General Public License
|
15
|
+
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
16
|
+
|
17
|
+
class EasyDice
|
18
|
+
|
19
|
+
VERSION = "0.0.2"
|
20
|
+
|
21
|
+
end
|
data/test/dice_test.rb
CHANGED
@@ -14,14 +14,6 @@
|
|
14
14
|
# You should have received a copy of the GNU General Public License
|
15
15
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
16
16
|
|
17
|
-
require 'helper'
|
18
|
-
|
19
|
-
# someone will probably scold me for this
|
20
|
-
class Dice
|
21
|
-
attr_accessor :count, :sides
|
22
|
-
attr_accessor :parent, :child
|
23
|
-
end
|
24
|
-
|
25
17
|
class DiceTest < MiniTest::Unit::TestCase
|
26
18
|
|
27
19
|
def teardown
|
data/test/easy_dice_test.rb
CHANGED
data/test/helper.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: easy_dice
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Adam Price
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-
|
11
|
+
date: 2013-08-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -52,6 +52,20 @@ dependencies:
|
|
52
52
|
- - ~>
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0.7'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: debugger
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - '>='
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
55
69
|
description: Gem for rolling polyhedral dice.
|
56
70
|
email:
|
57
71
|
- komidore64@gmail.com
|
@@ -72,6 +86,7 @@ files:
|
|
72
86
|
- lib/easy_dice/easy_dice.rb
|
73
87
|
- lib/easy_dice/fixnum_d.rb
|
74
88
|
- lib/easy_dice/format_error.rb
|
89
|
+
- lib/easy_dice/version.rb
|
75
90
|
- rakefile
|
76
91
|
- test/dice_test.rb
|
77
92
|
- test/easy_dice_test.rb
|