chair 1.1.2 → 1.1.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5a6ec94854da3e028f8aea6f564c9cf63c9b9011
4
- data.tar.gz: 8d9c2bb02e94815fcaa7ace97ab291bc0c266e90
3
+ metadata.gz: 135fd8455ba29a7242581126e4be1786da3a40b1
4
+ data.tar.gz: 842cf58875a5aa9170d61eda5ecfac19b8c3e9b4
5
5
  SHA512:
6
- metadata.gz: 805790821f8a261f79c94c494b8431f700f552ad6aa5df2adc9886c9ad9673db3ff322811b638dabd0d397c02dfe5acbc9bbaaba5083923efcb38bab1f506eeb
7
- data.tar.gz: 7828bdc15695f86d5448bff224bd1eeeee9cb42e7dea3662da18f1134fd4ac147eec524c5b4b125a1d219ad62dd66c38d2e907fe6c5eb0d3c94c9fd414b1bc42
6
+ metadata.gz: 09b8b0804f473c9553fa4c046b634e79ccb434cb8e42cc46cb664d7193ef13c91d421da33a31f24ba86e51cdff940b4d7b79d84a031ff68068f2f4170d87bd49
7
+ data.tar.gz: db63d49dd58a13a769d0e8b3eefdd3f6b4c43337709f358d32f064767d1382e80bbc666174bb4c5e8f6b1ff30ddc4e446ffcca5627e35ec09bc62b3a5e34991d
@@ -215,20 +215,22 @@ class Chair
215
215
  end
216
216
  # For each key, value
217
217
  map.each_pair do |key, val|
218
- unless @pk_map.include? key # Check if we have the key in our pk_map. if not,
219
- if opts[:create_row] # if we can create rows,
220
- insert! @primary_key => key, column => val # create a row
221
- else raise "No such row with primary key #{key.inspect} exists" # or raise an error
218
+ if @pk_map.include? key
219
+ # if we do, check if the row has a value in the column
220
+ row = @table[@pk_map[key]]
221
+ # if it does, can we overwrite?
222
+ if row.has_attribute?(column) and not opts[:overwrite]
223
+ raise "Value already exists in table for primary key #{key.inspect} and column #{column.inspect}"
224
+ end
225
+ # if so, overwrite
226
+ row[column] = val
227
+ else # Check if we have the key in our pk_map. if not,
228
+ if opts[:create_row] # if we can create rows,
229
+ insert! @primary_key => key, column => val # create a row
230
+ else
231
+ raise "No such row with primary key #{key.inspect} exists" # or raise an error
222
232
  end
223
233
  end
224
- # if we do, check if the row has a value in the column
225
- row = @table[@pk_map[key]]
226
- # if it does, can we overwrite?
227
- if row.has_attribute?(column) and not opts[:overwrite]
228
- raise "Value already exists in table for primary key #{key.inspect} and column #{column.inspect}"
229
- end
230
- # if so, overwrite
231
- row[column] = val
232
234
  end
233
235
  self
234
236
  end
@@ -1,3 +1,3 @@
1
1
  class Chair
2
- VERSION = "1.1.2"
2
+ VERSION = "1.1.3"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: chair
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.2
4
+ version: 1.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Katherine Whitlock