rails-backbone 0.6.1 → 0.7.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +5 -5
- data/vendor/assets/javascripts/backbone.js +524 -392
- data/vendor/assets/javascripts/underscore.js +26 -17
- metadata +9 -9
@@ -1,4 +1,4 @@
|
|
1
|
-
// Underscore.js 1.3.
|
1
|
+
// Underscore.js 1.3.1
|
2
2
|
// (c) 2009-2012 Jeremy Ashkenas, DocumentCloud Inc.
|
3
3
|
// Underscore is freely distributable under the MIT license.
|
4
4
|
// Portions of Underscore are inspired or borrowed from Prototype,
|
@@ -62,7 +62,7 @@
|
|
62
62
|
}
|
63
63
|
|
64
64
|
// Current version.
|
65
|
-
_.VERSION = '1.3.
|
65
|
+
_.VERSION = '1.3.1';
|
66
66
|
|
67
67
|
// Collection Functions
|
68
68
|
// --------------------
|
@@ -80,7 +80,7 @@
|
|
80
80
|
}
|
81
81
|
} else {
|
82
82
|
for (var key in obj) {
|
83
|
-
if (
|
83
|
+
if (_.has(obj, key)) {
|
84
84
|
if (iterator.call(context, obj[key], key, obj) === breaker) return;
|
85
85
|
}
|
86
86
|
}
|
@@ -89,7 +89,7 @@
|
|
89
89
|
|
90
90
|
// Return the results of applying the iterator to each element.
|
91
91
|
// Delegates to **ECMAScript 5**'s native `map` if available.
|
92
|
-
_.map = function(obj, iterator, context) {
|
92
|
+
_.map = _.collect = function(obj, iterator, context) {
|
93
93
|
var results = [];
|
94
94
|
if (obj == null) return results;
|
95
95
|
if (nativeMap && obj.map === nativeMap) return obj.map(iterator, context);
|
@@ -506,7 +506,7 @@
|
|
506
506
|
hasher || (hasher = _.identity);
|
507
507
|
return function() {
|
508
508
|
var key = hasher.apply(this, arguments);
|
509
|
-
return
|
509
|
+
return _.has(memo, key) ? memo[key] : (memo[key] = func.apply(this, arguments));
|
510
510
|
};
|
511
511
|
};
|
512
512
|
|
@@ -612,7 +612,7 @@
|
|
612
612
|
_.keys = nativeKeys || function(obj) {
|
613
613
|
if (obj !== Object(obj)) throw new TypeError('Invalid object');
|
614
614
|
var keys = [];
|
615
|
-
for (var key in obj) if (
|
615
|
+
for (var key in obj) if (_.has(obj, key)) keys[keys.length] = key;
|
616
616
|
return keys;
|
617
617
|
};
|
618
618
|
|
@@ -635,7 +635,7 @@
|
|
635
635
|
_.extend = function(obj) {
|
636
636
|
each(slice.call(arguments, 1), function(source) {
|
637
637
|
for (var prop in source) {
|
638
|
-
|
638
|
+
obj[prop] = source[prop];
|
639
639
|
}
|
640
640
|
});
|
641
641
|
return obj;
|
@@ -733,17 +733,17 @@
|
|
733
733
|
if ('constructor' in a != 'constructor' in b || a.constructor != b.constructor) return false;
|
734
734
|
// Deep compare objects.
|
735
735
|
for (var key in a) {
|
736
|
-
if (
|
736
|
+
if (_.has(a, key)) {
|
737
737
|
// Count the expected number of properties.
|
738
738
|
size++;
|
739
739
|
// Deep compare each member.
|
740
|
-
if (!(result =
|
740
|
+
if (!(result = _.has(b, key) && eq(a[key], b[key], stack))) break;
|
741
741
|
}
|
742
742
|
}
|
743
743
|
// Ensure that both objects contain the same number of properties.
|
744
744
|
if (result) {
|
745
745
|
for (key in b) {
|
746
|
-
if (
|
746
|
+
if (_.has(b, key) && !(size--)) break;
|
747
747
|
}
|
748
748
|
result = !size;
|
749
749
|
}
|
@@ -762,7 +762,7 @@
|
|
762
762
|
// An "empty" object has no enumerable own-properties.
|
763
763
|
_.isEmpty = function(obj) {
|
764
764
|
if (_.isArray(obj) || _.isString(obj)) return obj.length === 0;
|
765
|
-
for (var key in obj) if (
|
765
|
+
for (var key in obj) if (_.has(obj, key)) return false;
|
766
766
|
return true;
|
767
767
|
};
|
768
768
|
|
@@ -788,7 +788,7 @@
|
|
788
788
|
};
|
789
789
|
if (!_.isArguments(arguments)) {
|
790
790
|
_.isArguments = function(obj) {
|
791
|
-
return !!(obj &&
|
791
|
+
return !!(obj && _.has(obj, 'callee'));
|
792
792
|
};
|
793
793
|
}
|
794
794
|
|
@@ -838,6 +838,11 @@
|
|
838
838
|
return obj === void 0;
|
839
839
|
};
|
840
840
|
|
841
|
+
// Has own property?
|
842
|
+
_.has = function(obj, key) {
|
843
|
+
return hasOwnProperty.call(obj, key);
|
844
|
+
};
|
845
|
+
|
841
846
|
// Utility Functions
|
842
847
|
// -----------------
|
843
848
|
|
@@ -892,6 +897,12 @@
|
|
892
897
|
// guaranteed not to match.
|
893
898
|
var noMatch = /.^/;
|
894
899
|
|
900
|
+
// Within an interpolation, evaluation, or escaping, remove HTML escaping
|
901
|
+
// that had been previously added.
|
902
|
+
var unescape = function(code) {
|
903
|
+
return code.replace(/\\\\/g, '\\').replace(/\\'/g, "'");
|
904
|
+
};
|
905
|
+
|
895
906
|
// JavaScript micro-templating, similar to John Resig's implementation.
|
896
907
|
// Underscore templating handles arbitrary delimiters, preserves whitespace,
|
897
908
|
// and correctly escapes quotes within interpolated code.
|
@@ -902,15 +913,13 @@
|
|
902
913
|
str.replace(/\\/g, '\\\\')
|
903
914
|
.replace(/'/g, "\\'")
|
904
915
|
.replace(c.escape || noMatch, function(match, code) {
|
905
|
-
return "',_.escape(" + code
|
916
|
+
return "',_.escape(" + unescape(code) + "),'";
|
906
917
|
})
|
907
918
|
.replace(c.interpolate || noMatch, function(match, code) {
|
908
|
-
return "'," + code
|
919
|
+
return "'," + unescape(code) + ",'";
|
909
920
|
})
|
910
921
|
.replace(c.evaluate || noMatch, function(match, code) {
|
911
|
-
return "');" + code.replace(
|
912
|
-
.replace(/[\r\n\t]/g, ' ')
|
913
|
-
.replace(/\\\\/g, '\\') + ";__p.push('";
|
922
|
+
return "');" + unescape(code).replace(/[\r\n\t]/g, ' ') + ";__p.push('";
|
914
923
|
})
|
915
924
|
.replace(/\r/g, '\\r')
|
916
925
|
.replace(/\n/g, '\\n')
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rails-backbone
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.7.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,11 +10,11 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2012-
|
13
|
+
date: 2012-02-10 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: railties
|
17
|
-
requirement: &
|
17
|
+
requirement: &70350676743900 !ruby/object:Gem::Requirement
|
18
18
|
none: false
|
19
19
|
requirements:
|
20
20
|
- - ! '>='
|
@@ -22,10 +22,10 @@ dependencies:
|
|
22
22
|
version: 3.1.0
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
|
-
version_requirements: *
|
25
|
+
version_requirements: *70350676743900
|
26
26
|
- !ruby/object:Gem::Dependency
|
27
27
|
name: coffee-script
|
28
|
-
requirement: &
|
28
|
+
requirement: &70350676743140 !ruby/object:Gem::Requirement
|
29
29
|
none: false
|
30
30
|
requirements:
|
31
31
|
- - ~>
|
@@ -33,10 +33,10 @@ dependencies:
|
|
33
33
|
version: 2.2.0
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
|
-
version_requirements: *
|
36
|
+
version_requirements: *70350676743140
|
37
37
|
- !ruby/object:Gem::Dependency
|
38
38
|
name: ejs
|
39
|
-
requirement: &
|
39
|
+
requirement: &70350676742140 !ruby/object:Gem::Requirement
|
40
40
|
none: false
|
41
41
|
requirements:
|
42
42
|
- - ~>
|
@@ -44,7 +44,7 @@ dependencies:
|
|
44
44
|
version: 1.0.0
|
45
45
|
type: :runtime
|
46
46
|
prerelease: false
|
47
|
-
version_requirements: *
|
47
|
+
version_requirements: *70350676742140
|
48
48
|
description: Quickly setup backbone.js for use with rails 3.1. Generators are provided
|
49
49
|
to quickly get started.
|
50
50
|
email:
|
@@ -99,7 +99,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
99
99
|
version: '0'
|
100
100
|
segments:
|
101
101
|
- 0
|
102
|
-
hash: -
|
102
|
+
hash: -2226747858555248168
|
103
103
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
104
104
|
none: false
|
105
105
|
requirements:
|