brewery 0.2.0 → 0.3.0

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: f292b418ab2ec3c9d1a2a51a7f7ee9cef6045750
4
- data.tar.gz: 05c45d2dc3ed8fcbad4b12988ef215e7215e70e1
3
+ metadata.gz: b70d094580ccae545b4e47027a3b5c993b893967
4
+ data.tar.gz: ac1d08470a703b76fdbcc369c4b6cccf3e0516f9
5
5
  SHA512:
6
- metadata.gz: ad902125ec402463bc3a98970aa35edc6aaf6053b00983d00ea373bf5cc0f86b07c5d09c2036197e8a9a450e76a308e89e880b8ed69612ed561b3d462c27c3a8
7
- data.tar.gz: 6d44d34b69f070e07fcd4bff7c2214df8e284a5243dffe2d5bdac254860a0f42efc819c9001402338bc290fbfa3ea43a7b0168a029922f1815ab8b6631a265d3
6
+ metadata.gz: e46db66b4fca9fbdd4a9bd3a1f4fd9ff8efd17530d89c8ea64e4044655782fbf9266c48e649ced954df6bc9134ae077e676e4e40604c33e50a7a169047ba9ffd
7
+ data.tar.gz: 7d0c8e82ae2b23cbcafedb772423ef836c3c5a8850a50329506a66642521b7b6cede460ebab4139b1010b3f5e40b4555dc98e2c1294c661a2c9ae9809463e62b
data/.rspec CHANGED
@@ -1,3 +1,3 @@
1
1
  --color
2
- --format Fuubar
2
+ --format documentation
3
3
  -r pry
data/README.md CHANGED
@@ -95,9 +95,11 @@ fermentables = Brewery.ingredients :fermentables
95
95
  fermentables.count
96
96
  # => 187
97
97
 
98
- search = fermentables.find_by(name: 'pale ale')
99
- search.first.name
100
- # => "German Pale Ale Malt"
98
+ fermentables.find_by_name('pale ale')
99
+ fermentables.find_by_description('alber malt')
100
+ fermentables.find_by_color('22.000')
101
+ fermentables.find_by_moisture('3.0')
102
+ fermentables.find_by_extract('80.0')
101
103
  ```
102
104
 
103
105
  #### Hops
@@ -107,9 +109,9 @@ hops = Brewery.ingredients :hops
107
109
  hops.count
108
110
  # => 85
109
111
 
110
- search = hops.find_by(name: 'magnum')
111
- search.first.name
112
- # => "German Hallertauer Magnum"
112
+ hops.find_by_name('magnum')
113
+ hops.find_by_description('Australia')
114
+ hops.find_by_alpha('15.0')
113
115
  ```
114
116
 
115
117
  #### Yeast
@@ -119,9 +121,11 @@ yeasts = Brewery.ingredients :yeasts
119
121
  yeasts.count
120
122
  # => 208
121
123
 
122
- search = yeasts.find_by(name: 'us-05')
123
- search.first.name
124
- # => "DCL US-05 (formerly US-56) SafAle"
124
+ yeasts.find_by_name('us-05')
125
+ yeasts.find_by_description('fermenting strain')
126
+ yeasts.find_by_yeast_type('liquid')
127
+ yeasts.find_by_beer_type('Ale')
128
+ yeasts.find_by_beer_attenuation('75.0')
125
129
  ```
126
130
 
127
131
  ## Contributing
data/brewery.gemspec CHANGED
@@ -27,5 +27,4 @@ Gem::Specification.new do |spec|
27
27
  spec.add_development_dependency "rake"
28
28
  spec.add_development_dependency 'pry'
29
29
  spec.add_development_dependency 'rspec', '~> 2.14'
30
- spec.add_development_dependency 'fuubar'
31
30
  end
@@ -0,0 +1,185 @@
1
+ {
2
+ "IngredientType" : "Other",
3
+ "Ingredients" : [
4
+ {
5
+ "description" : "Allows the creation of drier beers than usual by converting longer chain, unfermentable sugars into those fermentable by yeast.",
6
+ "UUID" : "F4E40EB5-2300-11DA-9C39-001124CAE2A6",
7
+ "DateLastModified" : "\/\/Date:1372128898.013509",
8
+ "name" : "Amylase Enzyme"
9
+ },
10
+ {
11
+ "description" : "",
12
+ "UUID" : "15601EC8-2301-11DA-9C39-001124CAE2A6",
13
+ "DateLastModified" : "\/\/Date:1372128898.015244",
14
+ "name" : "Apricot Extract"
15
+ },
16
+ {
17
+ "description" : "",
18
+ "UUID" : "1D61E91B-2301-11DA-9C39-001124CAE2A6",
19
+ "DateLastModified" : "\/\/Date:1372128898.032827",
20
+ "name" : "Blackbery Extract"
21
+ },
22
+ {
23
+ "description" : "",
24
+ "UUID" : "FE2B9186-860B-4C06-A6B0-8C209463F415",
25
+ "DateLastModified" : "\/\/Date:1372128898.036854",
26
+ "name" : "Cherry Concentrate"
27
+ },
28
+ {
29
+ "description" : "",
30
+ "UUID" : "241C8472-2301-11DA-9C39-001124CAE2A6",
31
+ "DateLastModified" : "\/\/Date:1372128898.029880",
32
+ "name" : "Cherry Extract"
33
+ },
34
+ {
35
+ "description" : "",
36
+ "UUID" : "2BC79C4A-2301-11DA-9C39-001124CAE2A6",
37
+ "DateLastModified" : "\/\/Date:1372128898.033815",
38
+ "name" : "Cinnamon Stick"
39
+ },
40
+ {
41
+ "description" : "",
42
+ "UUID" : "3346B4D6-2301-11DA-9C39-001124CAE2A6",
43
+ "DateLastModified" : "\/\/Date:1372128898.019550",
44
+ "name" : "Clearfine"
45
+ },
46
+ {
47
+ "description" : "",
48
+ "UUID" : "602E8257-2EE3-4776-8B0A-1B8AF7B4BC73",
49
+ "DateLastModified" : "\/\/Date:1372128898.024759",
50
+ "name" : "Coffee, Ground"
51
+ },
52
+ {
53
+ "description" : "",
54
+ "UUID" : "48A8E436-2301-11DA-9C39-001124CAE2A6",
55
+ "DateLastModified" : "\/\/Date:1372128898.017082",
56
+ "name" : "Coriander Seed"
57
+ },
58
+ {
59
+ "description" : "",
60
+ "UUID" : "4F493C1C-2301-11DA-9C39-001124CAE2A6",
61
+ "DateLastModified" : "\/\/Date:1372128898.016254",
62
+ "name" : "Cranberry Extract"
63
+ },
64
+ {
65
+ "description" : "Added to the fermenter to reduce foaming during fermentation. Very handy if you don't have much headspace in your fermenter!",
66
+ "UUID" : "11423437-C55A-4081-967F-A2D96B531C37",
67
+ "DateLastModified" : "\/\/Date:1372128898.028884",
68
+ "name" : "Foam Control (Anti-Foam)"
69
+ },
70
+ {
71
+ "description" : "Used as a fining agent to promote sedimentation of yeast.",
72
+ "UUID" : "5E4BCA2C-2301-11DA-9C39-001124CAE2A6",
73
+ "DateLastModified" : "\/\/Date:1372128898.026880",
74
+ "name" : "Gelatine"
75
+ },
76
+ {
77
+ "description" : "",
78
+ "UUID" : "652C3E80-2301-11DA-9C39-001124CAE2A6",
79
+ "DateLastModified" : "\/\/Date:1372128898.034810",
80
+ "name" : "Ginger Root"
81
+ },
82
+ {
83
+ "description" : "A kettle fining that promotes the coagulation of proteins in the boil.",
84
+ "UUID" : "6D775BBA-2301-11DA-9C39-001124CAE2A6",
85
+ "DateLastModified" : "\/\/Date:1372128898.025801",
86
+ "name" : "Irish Moss"
87
+ },
88
+ {
89
+ "description" : "Used as a fining agent to promote sedimentation of yeast.",
90
+ "UUID" : "74CD47B2-2301-11DA-9C39-001124CAE2A6",
91
+ "DateLastModified" : "\/\/Date:1372128898.022302",
92
+ "name" : "Isinglass"
93
+ },
94
+ {
95
+ "description" : "Sometimes added to adjust mash pH. May also be added to fermented beers to increase 'sourness'.",
96
+ "UUID" : "7FD6FEE5-2301-11DA-9C39-001124CAE2A6",
97
+ "DateLastModified" : "\/\/Date:1372128898.042052",
98
+ "name" : "Lactic Acid"
99
+ },
100
+ {
101
+ "description" : "",
102
+ "UUID" : "865267BA-2301-11DA-9C39-001124CAE2A6",
103
+ "DateLastModified" : "\/\/Date:1372128898.018680",
104
+ "name" : "Malto-Dextrine"
105
+ },
106
+ {
107
+ "description" : "",
108
+ "UUID" : "8D3B8A2A-2301-11DA-9C39-001124CAE2A6",
109
+ "DateLastModified" : "\/\/Date:1372128898.027900",
110
+ "name" : "Orange Peel, Bitter"
111
+ },
112
+ {
113
+ "description" : "",
114
+ "UUID" : "945C123E-2301-11DA-9C39-001124CAE2A6",
115
+ "DateLastModified" : "\/\/Date:1372128898.017889",
116
+ "name" : "Orange Peel, Sweet"
117
+ },
118
+ {
119
+ "description" : "A fining agent that removes haze forming proteins from finished beer.",
120
+ "UUID" : "9D16E85E-2301-11DA-9C39-001124CAE2A6",
121
+ "DateLastModified" : "\/\/Date:1372128898.040986",
122
+ "name" : "Polyclar"
123
+ },
124
+ {
125
+ "description" : "A kettle fining that promotes the coagulation of proteins in the boil.",
126
+ "UUID" : "40130D54-2301-11DA-9C39-001124CAE2A6",
127
+ "DateLastModified" : "\/\/Date:1372128898.021325",
128
+ "name" : "Protafloc"
129
+ },
130
+ {
131
+ "description" : "",
132
+ "UUID" : "085DC41E-5DFB-11DA-92C9-001124CAE2A6",
133
+ "DateLastModified" : "\/\/Date:1372128898.039949",
134
+ "name" : "Raisins"
135
+ },
136
+ {
137
+ "description" : "",
138
+ "UUID" : "A53DB406-2301-11DA-9C39-001124CAE2A6",
139
+ "DateLastModified" : "\/\/Date:1372128898.023111",
140
+ "name" : "Raspberry Extract"
141
+ },
142
+ {
143
+ "description" : "",
144
+ "UUID" : "AC3384C8-2301-11DA-9C39-001124CAE2A6",
145
+ "DateLastModified" : "\/\/Date:1372128898.037872",
146
+ "name" : "Sassafras"
147
+ },
148
+ {
149
+ "description" : "",
150
+ "UUID" : "B348C51F-2301-11DA-9C39-001124CAE2A6",
151
+ "DateLastModified" : "\/\/Date:1372128898.030855",
152
+ "name" : "Seeds of Paradise"
153
+ },
154
+ {
155
+ "description" : "",
156
+ "UUID" : "06BC1F48-2301-11DA-9C39-001124CAE2A6",
157
+ "DateLastModified" : "\/\/Date:1372128898.020485",
158
+ "name" : "Star Anise"
159
+ },
160
+ {
161
+ "description" : "",
162
+ "UUID" : "564EC2FC-2301-11DA-9C39-001124CAE2A6",
163
+ "DateLastModified" : "\/\/Date:1372128898.035827",
164
+ "name" : "Sweet Gale"
165
+ },
166
+ {
167
+ "description" : "",
168
+ "UUID" : "2DC801D7-87D9-45F2-892B-1CE09679F519",
169
+ "DateLastModified" : "\/\/Date:1372128898.023923",
170
+ "name" : "Vanilla Beans"
171
+ },
172
+ {
173
+ "description" : "A kettle fining that promotes the coagulation of proteins in the boil.",
174
+ "UUID" : "BBE9652B-2301-11DA-9C39-001124CAE2A6",
175
+ "DateLastModified" : "\/\/Date:1372128898.038890",
176
+ "name" : "Whirlfloc Tablet"
177
+ },
178
+ {
179
+ "description" : "Promotes healthy yeast and strong fermentation by increasing free amino nitrogen and other essential nutrients in the wort.",
180
+ "UUID" : "C3174634-2301-11DA-9C39-001124CAE2A6",
181
+ "DateLastModified" : "\/\/Date:1372128898.031842",
182
+ "name" : "Yeast Nutrient"
183
+ }
184
+ ]
185
+ }
@@ -13,8 +13,18 @@ module Brewery
13
13
  @collection.each {|element| yield(Hashie::Mash.new(element)) }
14
14
  end
15
15
 
16
- def find_by(name: nil)
17
- self.find_all {|v| v.name =~ /#{name}/i}
16
+ def method_missing(method, *args)
17
+ if method.to_s =~ /^find_by_(.*)$/
18
+ attr = $1.to_sym
19
+ find_all {|i| i.send(attr) =~ /#{args.first}/i}
20
+ else
21
+ super
22
+ end
23
+ end
24
+
25
+ def respond_to?(method, include_private = false)
26
+ return true if method.to_s =~ /^find_by_(.*)$/
27
+ super
18
28
  end
19
29
 
20
30
  private
@@ -35,5 +45,9 @@ module Brewery
35
45
  class Yeasts
36
46
  include InstanceMethods
37
47
  end
48
+
49
+ class Other
50
+ include InstanceMethods
51
+ end
38
52
  end
39
53
  end
@@ -1,3 +1,3 @@
1
1
  module Brewery
2
- VERSION = "0.2.0"
2
+ VERSION = "0.3.0"
3
3
  end
@@ -17,9 +17,9 @@ describe Brewery::Ingredient do
17
17
  end
18
18
 
19
19
  context "search" do
20
- let(:search) { fermentables.find_by(name: 'pale') }
21
-
22
- it { expect(search.count).to eql(8) }
20
+ %w(description color moisture extract name).each do |attr|
21
+ it { expect(fermentables).to respond_to("find_by_#{attr}".to_sym) }
22
+ end
23
23
  end
24
24
  end
25
25
 
@@ -37,9 +37,9 @@ describe Brewery::Ingredient do
37
37
  end
38
38
 
39
39
  context "search" do
40
- let(:search) { hops.find_by(name: 'mag') }
41
-
42
- it { expect(search.count).to eql(2) }
40
+ %w(description alpha name).each do |attr|
41
+ it { expect(hops).to respond_to("find_by_#{attr}".to_sym) }
42
+ end
43
43
  end
44
44
  end
45
45
 
@@ -59,9 +59,28 @@ describe Brewery::Ingredient do
59
59
  end
60
60
 
61
61
  context "search" do
62
- let(:search) { yeasts.find_by(name: '05') }
62
+ %w(description yeast_type beer_type attenuation name).each do |attr|
63
+ it { expect(yeasts).to respond_to("find_by_#{attr}".to_sym) }
64
+ end
65
+ end
66
+ end
67
+
68
+ context "Other Ingredients" do
69
+ let(:other) { Brewery.ingredients :other }
63
70
 
64
- it { expect(search.count).to eql(7) }
71
+ it { expect(other.count).to eql(30) }
72
+
73
+ context "other ingredients data" do
74
+ let(:amylase) { other.first }
75
+
76
+ it { expect(amylase.description).to include('Allows the creation of drier beers than') }
77
+ it { expect(amylase.name).to eq('Amylase Enzyme') }
78
+ end
79
+
80
+ context "search" do
81
+ %w(name description).each do |attr|
82
+ it { expect(other).to respond_to("find_by_#{attr}".to_sym) }
83
+ end
65
84
  end
66
85
  end
67
86
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: brewery
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jesus Lopes
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-09-26 00:00:00.000000000 Z
11
+ date: 2013-09-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: nokogiri
@@ -94,20 +94,6 @@ dependencies:
94
94
  - - ~>
95
95
  - !ruby/object:Gem::Version
96
96
  version: '2.14'
97
- - !ruby/object:Gem::Dependency
98
- name: fuubar
99
- requirement: !ruby/object:Gem::Requirement
100
- requirements:
101
- - - '>='
102
- - !ruby/object:Gem::Version
103
- version: '0'
104
- type: :development
105
- prerelease: false
106
- version_requirements: !ruby/object:Gem::Requirement
107
- requirements:
108
- - - '>='
109
- - !ruby/object:Gem::Version
110
- version: '0'
111
97
  description: Tools for Homebrewing
112
98
  email:
113
99
  - jlopes@zigotto.com.br
@@ -126,6 +112,7 @@ files:
126
112
  - lib/brewery.rb
127
113
  - lib/brewery/data/fermentables.json
128
114
  - lib/brewery/data/hops.json
115
+ - lib/brewery/data/other.json
129
116
  - lib/brewery/data/styleguide.dtd
130
117
  - lib/brewery/data/styleguide2008.xml
131
118
  - lib/brewery/data/yeasts.json