backbone_extensions 0.0.7 → 0.0.8

Sign up to get free protection for your applications and to get access to all the features.
@@ -53,11 +53,11 @@
53
53
 
54
54
  function parseAssociation(associationType, associationName, options) {
55
55
  function parseResponseWith(key, response) {
56
- var parseKey;
56
+ var result;
57
57
  return _([_.str.camelize, _.str.underscored]).any(function(fn) {
58
58
  var k = fn(key);
59
- return (parseKey = response[k] && {key: k, response: response[k]});
60
- }) && parseKey || {response: null};
59
+ return (result = response[k] && {key: k, response: response[k]});
60
+ }) && result || {response: null};
61
61
  }
62
62
 
63
63
  function through(response) {
@@ -87,10 +87,9 @@
87
87
  parseResponseWith(associationName, response);
88
88
  };
89
89
 
90
- if(!this._parsers) {
91
- var originalParse = this.prototype.parse,
92
- parsers = this._parsers = [];
93
- this.prototype.parse = function(response) {
90
+ if (!this._parsers) {
91
+ var parsers = this._parsers = [];
92
+ this.prototype.parse = _(this.prototype.parse).wrap(function(originalParse, response) {
94
93
  return _(originalParse.call(this, response)).tap(_(function(parsedResponse) {
95
94
  _(parsers)
96
95
  .chain()
@@ -103,7 +102,7 @@
103
102
  return key && delete parsedResponse[key];
104
103
  });
105
104
  }).bind(this));
106
- };
105
+ });
107
106
  }
108
107
 
109
108
  this._parsers.push({
@@ -1,3 +1,3 @@
1
1
  module BackboneExtensions
2
- VERSION = '0.0.7'
2
+ VERSION = '0.0.8'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: backbone_extensions
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 0.0.8
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -126,7 +126,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
126
126
  version: '0'
127
127
  segments:
128
128
  - 0
129
- hash: -2212629205291919389
129
+ hash: 786752361875731310
130
130
  required_rubygems_version: !ruby/object:Gem::Requirement
131
131
  none: false
132
132
  requirements:
@@ -135,7 +135,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
135
135
  version: '0'
136
136
  segments:
137
137
  - 0
138
- hash: -2212629205291919389
138
+ hash: 786752361875731310
139
139
  requirements: []
140
140
  rubyforge_project:
141
141
  rubygems_version: 1.8.24