pot_of_coffee 0.1.0 → 0.1.3
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 +4 -4
- data/README.md +52 -6
- data/lib/pot_of_coffee/units.rb +3 -3
- data/lib/pot_of_coffee/version.rb +1 -1
- data/test/test_units.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2965ddf1855b70dfef81fef85011fb6fe8708254
|
4
|
+
data.tar.gz: b9473aa3e867606b624238975d91174282cdb688
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 839c853825208c76183555682bf19ddb10739ee52cd5fc383e72d3fec769d2f076e76d263adc7e6bfa70131d71bc76a19523886e10152ec14e6aa746e7a9a7e0
|
7
|
+
data.tar.gz: 3a4ea38cec9c59373db2c20a06e67869786314e1a28aadd4d7a39561e0480a94a4afce60986bcbe94ba037e4747de584914a75cefce8edbe3b553f3eba82ecdb
|
data/README.md
CHANGED
@@ -1,6 +1,9 @@
|
|
1
1
|
# PotOfCoffee
|
2
2
|
|
3
|
-
This is a command line coffee brew calculator.
|
3
|
+
This is a command line coffee brew calculator.
|
4
|
+
Enter the number of cups you want and the strength.
|
5
|
+
It can also be used in your own code, and you can supply your own units for grounds if you don't want to use tablespoons.
|
6
|
+
I use it to maintain intra-office harmony.
|
4
7
|
|
5
8
|
## Installation
|
6
9
|
|
@@ -22,19 +25,62 @@ Or install it yourself as:
|
|
22
25
|
|
23
26
|
### CLI
|
24
27
|
```ruby
|
25
|
-
pot_of_coffee 12 normal # "
|
26
|
-
pot_of_coffee 12 blagg # "
|
28
|
+
pot_of_coffee 12 normal # "To make 12 cups of coffee, use 8.1 tbsp of grounds."
|
29
|
+
pot_of_coffee 12 blagg # "Sorry: coffee strength must be strong, normal, or weak"
|
27
30
|
```
|
28
31
|
|
29
|
-
###
|
32
|
+
### Ruby
|
30
33
|
```ruby
|
34
|
+
require 'pot_of_coffee'
|
35
|
+
|
31
36
|
pot_of_coffee = PotOfCoffee::Brewer.new(quantity: 12, strength: 'weak')
|
32
|
-
pot_of_coffee.
|
37
|
+
pot_of_coffee.amount # 6.0
|
38
|
+
pot_of_coffee.instructions # 'To make 12 cups of normal strength coffee, use 6.0 tbsp of grounds.'
|
39
|
+
|
40
|
+
# Metric units
|
41
|
+
|
42
|
+
pot_of_coffee = PotOfCoffee::Brewer.new(units: PotOfCoffee::MetricUnit.new)
|
43
|
+
pot_of_coffee.amount # 63.6
|
44
|
+
pot_of_coffee.instructions # 'To make 12 cups of normal strength coffee, use 63.6 g of grounds.'
|
45
|
+
```
|
46
|
+
|
47
|
+
## Using your own units
|
48
|
+
If you want to use a different set of units or different ratios, you can do so quite simply.
|
49
|
+
Just supply an object that responds to `name`, `abbreviation`, and `table`.
|
50
|
+
`name` and `abbreviation` must be strings.
|
51
|
+
`name` is not used at the moment, but it may be in the future.
|
52
|
+
`table` must be a hash.
|
53
|
+
I chose to provide three keys: `:strong`, `:normal`, and `:weak`, but you can use whatever you'd like.
|
54
|
+
|
55
|
+
### Example
|
56
|
+
```ruby
|
57
|
+
require 'pot_of_coffee'
|
58
|
+
|
59
|
+
class CorgeUnit
|
60
|
+
def name
|
61
|
+
'corge'
|
62
|
+
end
|
63
|
+
|
64
|
+
def abbreviation
|
65
|
+
'cg'
|
66
|
+
end
|
67
|
+
|
68
|
+
def table
|
69
|
+
{
|
70
|
+
strong: 3900,
|
71
|
+
normal: 200,
|
72
|
+
weak: 100
|
73
|
+
}
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
77
|
+
pot_of_coffee = PotOfCoffee::Brewer.new(quantity: 3, strength: :weak, units: CorgeUnit.new)
|
78
|
+
pot_of_coffee.amount # 300
|
33
79
|
```
|
34
80
|
|
35
81
|
## Tests
|
36
82
|
|
37
|
-
Clone the repo and run `rake test`.
|
83
|
+
Clone the repo and run `rake test`.
|
38
84
|
|
39
85
|
## Contributing
|
40
86
|
|
data/lib/pot_of_coffee/units.rb
CHANGED
data/test/test_units.rb
CHANGED
@@ -4,7 +4,7 @@ require 'whatever_unit'
|
|
4
4
|
class TestUnits < Minitest::Test
|
5
5
|
def test_can_use_metric_units
|
6
6
|
@pot_of_coffee = PotOfCoffee::Brewer.new(units: PotOfCoffee::MetricUnit.new)
|
7
|
-
assert_equal @pot_of_coffee.instructions, 'To make 12 cups of of normal coffee, use
|
7
|
+
assert_equal @pot_of_coffee.instructions, 'To make 12 cups of of normal coffee, use 63.6 g of grounds.'
|
8
8
|
end
|
9
9
|
|
10
10
|
def test_can_provide_your_own_units
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pot_of_coffee
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dave Shaffer
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-02-
|
11
|
+
date: 2016-02-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|