fridge_api 0.1.1 → 0.1.2

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.
@@ -19,7 +19,7 @@ module FridgeApi
19
19
  def commit
20
20
  @raw.each do |key, val|
21
21
  if val.kind_of? Array
22
- if val.first[:part_definition_id]
22
+ if is_part? val
23
23
  val.each do |i, part|
24
24
  part_name = part_name(part)
25
25
  unless part_value(part) == @attrs[part_name]
@@ -56,7 +56,7 @@ module FridgeApi
56
56
  hash = {}
57
57
  @raw.each do |key, val|
58
58
  if val.kind_of? Array
59
- if val.first[:part_definition_id]
59
+ if is_part? val
60
60
  val.each do |part|
61
61
  hash[part_name(part)] = part_value(part)
62
62
  end
@@ -72,6 +72,10 @@ module FridgeApi
72
72
  hash
73
73
  end
74
74
 
75
+ def is_part?(val)
76
+ val.first && val.first[:part_definition_id]
77
+ end
78
+
75
79
  def part_name(part)
76
80
  name = part[:part] ? part[:part][:name] : part[:name]
77
81
  name.to_sym
@@ -1,5 +1,5 @@
1
1
  module FridgeApi
2
2
 
3
- VERSION = "0.1.1".freeze
3
+ VERSION = "0.1.2".freeze
4
4
 
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fridge_api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: