synced 0.0.4 → 0.0.5

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: 9269d91cf4e1c50718fb11cc8c3a6860ede34a3a
4
- data.tar.gz: 07a7b737a0d403e3e78011a2dd9b49385e65bfa9
3
+ metadata.gz: 9b354ac0d6a11182622ca00701ea3e659280017b
4
+ data.tar.gz: 106c323663177869a9d0f458edafa4bbb81f2b2c
5
5
  SHA512:
6
- metadata.gz: e787d2b0ccca79dd8cd4dbe21814bbef16664e88290a82185253a88e4e4088cac2c30b8c925b8e01e2048570d552b0696151f06e1d9dde0ddcf8b5edca767613
7
- data.tar.gz: 5236ccc2bebfbd74810f21d29630075322426a6c5ffc9e60fed447b912637b05875a96f74536240c9212764217c600a907633bf87355364159400b25b522cec1
6
+ metadata.gz: a583f7a72398c4b0bd0103eea0dbf6124305c24cf0615ab7987409b68c97c202a6bb00cd27a699196d33dc5f53f88cef2cbbdbc8ac7dcdccb06ae3e3a01d1a0f
7
+ data.tar.gz: 7ebde8714a3f64bce1fd301fd0f31965fda175e42ff6decf5735661a699f29826266632083516509a799370dfd382671533b9ce10355e365ef9ee846373fdf2f
@@ -42,7 +42,7 @@ module Synced
42
42
  @remove = options[:remove]
43
43
  @only_updated = options[:only_updated]
44
44
  @include = options[:include]
45
- @local_attributes = Array(options[:local_attributes])
45
+ @local_attributes = options[:local_attributes]
46
46
  @associations = Array(options[:associations])
47
47
  @remote_objects = Array(remote_objects) if remote_objects
48
48
  @request_performed = false
@@ -75,7 +75,11 @@ module Synced
75
75
  private
76
76
 
77
77
  def local_attributes_mapping(remote)
78
- Hash[@local_attributes.map { |k| [k, remote[k]] }]
78
+ if @local_attributes.is_a?(Hash)
79
+ Hash[@local_attributes.map { |k, v| [k, remote[v]] }]
80
+ else
81
+ Hash[Array(@local_attributes).map { |k| [k, remote[k]] }]
82
+ end
79
83
  end
80
84
 
81
85
  def default_attributes_mapping(remote)
@@ -1,3 +1,3 @@
1
1
  module Synced
2
- VERSION = "0.0.4"
2
+ VERSION = "0.0.5"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: synced
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sebastien Grosjean