cosing 0.1.0 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +8 -0
- data/lib/cosing/annex.rb +1 -1
- data/lib/cosing/version.rb +1 -1
- data/lib/cosing.rb +9 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f8245d14649aa663ff0ca0040225bc053ed852f7c031aa3bb47f79ca56661053
|
4
|
+
data.tar.gz: e781a56530b98ae057254e5a8d1519ed0a0ba92bf92f31bc40e48e71ff9d4576
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dbf059495373b414a5a369b8e099b02809c2f977eb34263802c984841a640994489c75448df2c39c0e963fcdc0cd9ce8a071b635206c268b5aecf93754ce8c02
|
7
|
+
data.tar.gz: 686d2f6b59dea8a9d110cff1e2fe0aa711b1c8265d7922968425a741d6f2f7762c8942954b28d134df85621e3e755e7baeaa56293dc4ce127b5ab04dafb105d5
|
data/CHANGELOG.md
CHANGED
data/lib/cosing/annex.rb
CHANGED
data/lib/cosing/version.rb
CHANGED
data/lib/cosing.rb
CHANGED
@@ -2,6 +2,7 @@
|
|
2
2
|
|
3
3
|
require "csv"
|
4
4
|
require "json"
|
5
|
+
require "pathname"
|
5
6
|
require "dry/types"
|
6
7
|
require "dry/struct"
|
7
8
|
require_relative "cosing/version"
|
@@ -13,12 +14,15 @@ require_relative "cosing/database"
|
|
13
14
|
module Cosing
|
14
15
|
module_function
|
15
16
|
|
17
|
+
GEM_ROOT = File.expand_path("..", __dir__)
|
18
|
+
|
16
19
|
class Error < StandardError; end
|
17
20
|
# Your code goes here...
|
18
21
|
|
19
22
|
def load
|
20
23
|
Database.new(Annex.load).tap do |database|
|
21
|
-
|
24
|
+
path = gem_path("data/ingredients.csv")
|
25
|
+
ingredient_file = File.read(path).delete("\r")
|
22
26
|
|
23
27
|
CSV.parse(
|
24
28
|
ingredient_file,
|
@@ -36,4 +40,8 @@ module Cosing
|
|
36
40
|
end
|
37
41
|
end
|
38
42
|
end
|
43
|
+
|
44
|
+
def gem_path(path)
|
45
|
+
Pathname.new(GEM_ROOT).join(path)
|
46
|
+
end
|
39
47
|
end
|