hangry 0.0.8 → 0.0.9

Sign up to get free protection for your applications and to get access to all the features.
@@ -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
- value(nutrition_node_with_itemprop(itemprop).content)
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
- clean_string node_with_itemprop(:recipeInstructions).content, preserve_newlines: true
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 node_with_itemprop(:recipeYield).content
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
@@ -1,3 +1,3 @@
1
1
  module Hangry
2
- VERSION = "0.0.8"
2
+ VERSION = "0.0.9"
3
3
  end