brewery 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +17 -0
- data/.rspec +3 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +29 -0
- data/Rakefile +6 -0
- data/brewery.gemspec +27 -0
- data/lib/brewery/version.rb +3 -0
- data/lib/brewery.rb +32 -0
- data/spec/refractometer_spec.rb +33 -0
- data/spec/spec_helper.rb +19 -0
- metadata +114 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 38e914a37e147115692d912ac0ceed89c47c9f04
|
4
|
+
data.tar.gz: c6027829d8b526fc6e74045fe592b4e74a33812a
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 9353cdfd11b4eec71495d974f77945aa25f79fa097cef16102f874ea6eb343a385d1003580ad3aca963d6fbf794f6a32a82ce455e843d1ce37112baaaf0b5d90
|
7
|
+
data.tar.gz: 23a697dbccc22aa6ae69bee65373edaccda2317eb0d1a948c02a746cdac213f24086657f57df12d5031e1a3534d2818ae72c420d741644e4f2f752794a009912
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2013 Zigotto
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
# Brewery
|
2
|
+
|
3
|
+
For now, some formulas and tools for Homebrewing.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
gem 'brewery'
|
10
|
+
|
11
|
+
And then execute:
|
12
|
+
|
13
|
+
$ bundle
|
14
|
+
|
15
|
+
Or install it yourself as:
|
16
|
+
|
17
|
+
$ gem install brewery
|
18
|
+
|
19
|
+
## Usage
|
20
|
+
|
21
|
+
Comming soon.
|
22
|
+
|
23
|
+
## Contributing
|
24
|
+
|
25
|
+
1. Fork it
|
26
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
27
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
28
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
29
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
data/brewery.gemspec
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'brewery/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "brewery"
|
8
|
+
spec.version = Brewery::VERSION
|
9
|
+
spec.authors = ["Jesus Lopes"]
|
10
|
+
spec.email = ["jlopes@zigotto.com.br"]
|
11
|
+
spec.description = %q{Tools for Homebrewing}
|
12
|
+
spec.summary = %q{Tools for Homebrewing}
|
13
|
+
spec.homepage = ""
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.required_ruby_version = '>= 1.9'
|
17
|
+
|
18
|
+
spec.files = `git ls-files`.split($/)
|
19
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
20
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
21
|
+
spec.require_paths = ["lib"]
|
22
|
+
|
23
|
+
spec.add_development_dependency "bundler", "~> 1.3"
|
24
|
+
spec.add_development_dependency "rake"
|
25
|
+
spec.add_development_dependency 'pry'
|
26
|
+
spec.add_development_dependency 'rspec', '~> 2.14'
|
27
|
+
end
|
data/lib/brewery.rb
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
require "brewery/version"
|
2
|
+
|
3
|
+
module Brewery
|
4
|
+
class Refractometer
|
5
|
+
attr_accessor :original_brix, :final_brix
|
6
|
+
|
7
|
+
def initialize(args)
|
8
|
+
@original_brix = args[:original_brix]
|
9
|
+
@final_brix = args[:final_brix]
|
10
|
+
end
|
11
|
+
|
12
|
+
def specific_gravity
|
13
|
+
1.000898 + (0.003859118*original_brix) + (0.00001370735*original_brix*original_brix) + (0.00000003742517*original_brix*original_brix*original_brix)
|
14
|
+
end
|
15
|
+
|
16
|
+
def final_gravity
|
17
|
+
1.001843 - (0.002318474*original_brix) - (0.000007775*original_brix*original_brix) - (0.000000034*original_brix*original_brix*original_brix) + (0.00574*final_brix) + (0.00003344*final_brix*final_brix) + (0.000000086*final_brix*final_brix*final_brix)
|
18
|
+
end
|
19
|
+
|
20
|
+
def index_of_refraction
|
21
|
+
1.33302 + (0.001427193*final_brix) + (0.000005791157*final_brix*final_brix)
|
22
|
+
end
|
23
|
+
|
24
|
+
def alcohol_by_weight
|
25
|
+
1017.5596 - (277.4*final_gravity) + index_of_refraction*((937.8135*index_of_refraction) - 1805.1228)
|
26
|
+
end
|
27
|
+
|
28
|
+
def alcohol_by_volume
|
29
|
+
alcohol_by_weight*(final_gravity/0.794)
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Brewery::Refractometer do
|
4
|
+
context "Brix to Specific Gravity" do
|
5
|
+
let(:tool) { Brewery::Refractometer.new(original_brix: 17) }
|
6
|
+
|
7
|
+
describe "#specific_gravity" do
|
8
|
+
it "should return the specific gravity of the original brix" do
|
9
|
+
tool.specific_gravity.should eql(1.0706483000102098)
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
context "Corrected Final Gravity & ABV% by Brix" do
|
15
|
+
let(:tool) { Brewery::Refractometer.new(original_brix: 17, final_brix: 7.5) }
|
16
|
+
|
17
|
+
describe "#final_gravity" do
|
18
|
+
it { tool.final_gravity.should eql(1.0049822062500002) }
|
19
|
+
end
|
20
|
+
|
21
|
+
describe "#index_of_refraction" do
|
22
|
+
it { tool.index_of_refraction.should eql(1.34404970008125) }
|
23
|
+
end
|
24
|
+
|
25
|
+
describe "#alcohol_by_weight" do
|
26
|
+
it { tool.alcohol_by_weight.should eql(6.734352775327011) }
|
27
|
+
end
|
28
|
+
|
29
|
+
describe "#alcohol_by_volume" do
|
30
|
+
it { tool.alcohol_by_volume.should eql(8.523809458203969) }
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
require 'brewery'
|
2
|
+
|
3
|
+
# This file was generated by the `rspec --init` command. Conventionally, all
|
4
|
+
# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
|
5
|
+
# Require this file using `require "spec_helper"` to ensure that it is only
|
6
|
+
# loaded once.
|
7
|
+
#
|
8
|
+
# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
|
9
|
+
RSpec.configure do |config|
|
10
|
+
config.treat_symbols_as_metadata_keys_with_true_values = true
|
11
|
+
config.run_all_when_everything_filtered = true
|
12
|
+
config.filter_run :focus
|
13
|
+
|
14
|
+
# Run specs in random order to surface order dependencies. If you find an
|
15
|
+
# order dependency and want to debug it, you can fix the order by providing
|
16
|
+
# the seed, which is printed after each run.
|
17
|
+
# --seed 1234
|
18
|
+
config.order = 'random'
|
19
|
+
end
|
metadata
ADDED
@@ -0,0 +1,114 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: brewery
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Jesus Lopes
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2013-08-05 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ~>
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.3'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ~>
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.3'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - '>='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - '>='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: pry
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - '>='
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rspec
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ~>
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '2.14'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ~>
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '2.14'
|
69
|
+
description: Tools for Homebrewing
|
70
|
+
email:
|
71
|
+
- jlopes@zigotto.com.br
|
72
|
+
executables: []
|
73
|
+
extensions: []
|
74
|
+
extra_rdoc_files: []
|
75
|
+
files:
|
76
|
+
- .gitignore
|
77
|
+
- .rspec
|
78
|
+
- Gemfile
|
79
|
+
- LICENSE.txt
|
80
|
+
- README.md
|
81
|
+
- Rakefile
|
82
|
+
- brewery.gemspec
|
83
|
+
- lib/brewery.rb
|
84
|
+
- lib/brewery/version.rb
|
85
|
+
- spec/refractometer_spec.rb
|
86
|
+
- spec/spec_helper.rb
|
87
|
+
homepage: ''
|
88
|
+
licenses:
|
89
|
+
- MIT
|
90
|
+
metadata: {}
|
91
|
+
post_install_message:
|
92
|
+
rdoc_options: []
|
93
|
+
require_paths:
|
94
|
+
- lib
|
95
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
96
|
+
requirements:
|
97
|
+
- - '>='
|
98
|
+
- !ruby/object:Gem::Version
|
99
|
+
version: '1.9'
|
100
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
101
|
+
requirements:
|
102
|
+
- - '>='
|
103
|
+
- !ruby/object:Gem::Version
|
104
|
+
version: '0'
|
105
|
+
requirements: []
|
106
|
+
rubyforge_project:
|
107
|
+
rubygems_version: 2.0.2
|
108
|
+
signing_key:
|
109
|
+
specification_version: 4
|
110
|
+
summary: Tools for Homebrewing
|
111
|
+
test_files:
|
112
|
+
- spec/refractometer_spec.rb
|
113
|
+
- spec/spec_helper.rb
|
114
|
+
has_rdoc:
|