pot_of_coffee 0.1.0 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 59a334e469e37a0e133e778526d8a8b38ef395da
4
- data.tar.gz: 461e37e68c299d442826130f84d1079f9577184c
3
+ metadata.gz: 2965ddf1855b70dfef81fef85011fb6fe8708254
4
+ data.tar.gz: b9473aa3e867606b624238975d91174282cdb688
5
5
  SHA512:
6
- metadata.gz: 84cb6d8a8e2a5559369f59d06a4b92c9d804f3219bcc117c8c89d8cec5aac4acfba105f7a251dc28aa86cb83ce2b471e7b033d2625be205169086f06af66821f
7
- data.tar.gz: c89fe94927ddce0d9604b44a427dc45be34c10c4dcaa521760e5b86dd75e2caadee92291822ad65b1854a6d0d4f43512d935ef4ff66df0d6768b1bed2e466640
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. Enter the number of cups you want and the strength. I use it to maintain intra-office harmony.
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 # "Number of scoops needed: 8.1"
26
- pot_of_coffee 12 blagg # "I don't know how to make 'blagg' strength coffee, sorry. Available options are weak, normal, extra, turbo, starbucks, wtf"
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
- ### Rails
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.scoops # 6.0
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`. The test coverage is *very basic*.
83
+ Clone the repo and run `rake test`.
38
84
 
39
85
  ## Contributing
40
86
 
@@ -34,9 +34,9 @@ module PotOfCoffee
34
34
 
35
35
  def table
36
36
  {
37
- weak: 12,
38
- normal: 20,
39
- strong: 28,
37
+ weak: 3,
38
+ normal: 5.3,
39
+ strong: 10.6
40
40
  }
41
41
  end
42
42
  end
@@ -1,3 +1,3 @@
1
1
  module PotOfCoffee
2
- VERSION = '0.1.0'
2
+ VERSION = '0.1.3'
3
3
  end
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 240.0 g of grounds.'
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.0
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-05 00:00:00.000000000 Z
11
+ date: 2016-02-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler