hangry 0.0.8 → 0.0.9
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.
@@ -26,7 +26,9 @@ module Hangry
|
|
26
26
|
nutrition_ast.css("[itemprop = \"#{itemprop}\"]").first || NullObject.new
|
27
27
|
end
|
28
28
|
def nutrition_property_value(itemprop)
|
29
|
-
|
29
|
+
nutrition_node = nutrition_node_with_itemprop(itemprop)
|
30
|
+
value = value(nutrition_node['content']) || value(nutrition_node.content)
|
31
|
+
value ? value.strip : nil
|
30
32
|
end
|
31
33
|
def parse_author
|
32
34
|
author_node = node_with_itemprop(:author)
|
@@ -50,7 +52,8 @@ module Hangry
|
|
50
52
|
}.reject(&:blank?)
|
51
53
|
end
|
52
54
|
def parse_instructions
|
53
|
-
|
55
|
+
content = nodes_with_itemprop(:recipeInstructions).map(&:content).join("\n")
|
56
|
+
clean_string content, preserve_newlines: true
|
54
57
|
end
|
55
58
|
def parse_name
|
56
59
|
clean_string node_with_itemprop(:name).content
|
@@ -90,7 +93,10 @@ module Hangry
|
|
90
93
|
parse_time(:totalTime)
|
91
94
|
end
|
92
95
|
def parse_yield
|
93
|
-
clean_string
|
96
|
+
clean_string(
|
97
|
+
value(node_with_itemprop(:recipeYield)['content']) ||
|
98
|
+
value(node_with_itemprop(:recipeYield).content)
|
99
|
+
)
|
94
100
|
end
|
95
101
|
|
96
102
|
end
|
data/lib/hangry/version.rb
CHANGED