backbone-rails 1.0.0 → 1.0.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 31740c79831d708b571368016edaad0bf3c9dc45
4
+ data.tar.gz: f5b0583211f67eaafd3d711e4d05714e6c38784f
5
+ SHA512:
6
+ metadata.gz: 3691fa72a0cc29f728cd895598b6afe8f0f87b0e3c3a51bb5a91c93ed1d77ba0493bd1240c596c91c55a747b0540864219a25341876671439718ffece21b672a
7
+ data.tar.gz: 1b58614d37a07d0f70cdfa7346da85d752fbca398180a121ec7d4396d3d980c2c308c65319a4c7a56ec2d8b9dfd54e1873455a89a1941960b6a6885a9a2e6604
@@ -1,14 +1,13 @@
1
- // Underscore.js 1.4.4
2
- // ===================
1
+ // Underscore.js 1.5.1
2
+ // http://underscorejs.org
3
+ // (c) 2009-2013 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
4
+ // Underscore may be freely distributed under the MIT license.
3
5
 
4
- // > http://underscorejs.org
5
- // > (c) 2009-2013 Jeremy Ashkenas, DocumentCloud Inc.
6
- // > Underscore may be freely distributed under the MIT license.
7
-
8
- // Baseline setup
9
- // --------------
10
6
  (function() {
11
7
 
8
+ // Baseline setup
9
+ // --------------
10
+
12
11
  // Establish the root object, `window` in the browser, or `global` on the server.
13
12
  var root = this;
14
13
 
@@ -22,11 +21,12 @@
22
21
  var ArrayProto = Array.prototype, ObjProto = Object.prototype, FuncProto = Function.prototype;
23
22
 
24
23
  // Create quick reference variables for speed access to core prototypes.
25
- var push = ArrayProto.push,
26
- slice = ArrayProto.slice,
27
- concat = ArrayProto.concat,
28
- toString = ObjProto.toString,
29
- hasOwnProperty = ObjProto.hasOwnProperty;
24
+ var
25
+ push = ArrayProto.push,
26
+ slice = ArrayProto.slice,
27
+ concat = ArrayProto.concat,
28
+ toString = ObjProto.toString,
29
+ hasOwnProperty = ObjProto.hasOwnProperty;
30
30
 
31
31
  // All **ECMAScript 5** native function implementations that we hope to use
32
32
  // are declared here.
@@ -65,7 +65,7 @@
65
65
  }
66
66
 
67
67
  // Current version.
68
- _.VERSION = '1.4.4';
68
+ _.VERSION = '1.5.1';
69
69
 
70
70
  // Collection Functions
71
71
  // --------------------
@@ -97,7 +97,7 @@
97
97
  if (obj == null) return results;
98
98
  if (nativeMap && obj.map === nativeMap) return obj.map(iterator, context);
99
99
  each(obj, function(value, index, list) {
100
- results[results.length] = iterator.call(context, value, index, list);
100
+ results.push(iterator.call(context, value, index, list));
101
101
  });
102
102
  return results;
103
103
  };
@@ -172,7 +172,7 @@
172
172
  if (obj == null) return results;
173
173
  if (nativeFilter && obj.filter === nativeFilter) return obj.filter(iterator, context);
174
174
  each(obj, function(value, index, list) {
175
- if (iterator.call(context, value, index, list)) results[results.length] = value;
175
+ if (iterator.call(context, value, index, list)) results.push(value);
176
176
  });
177
177
  return results;
178
178
  };
@@ -239,7 +239,7 @@
239
239
  // Convenience version of a common use case of `filter`: selecting only objects
240
240
  // containing specific `key:value` pairs.
241
241
  _.where = function(obj, attrs, first) {
242
- if (_.isEmpty(attrs)) return first ? null : [];
242
+ if (_.isEmpty(attrs)) return first ? void 0 : [];
243
243
  return _[first ? 'find' : 'filter'](obj, function(value) {
244
244
  for (var key in attrs) {
245
245
  if (attrs[key] !== value[key]) return false;
@@ -256,7 +256,7 @@
256
256
 
257
257
  // Return the maximum element or (element-based computation).
258
258
  // Can't optimize arrays of integers longer than 65,535 elements.
259
- // See: https://bugs.webkit.org/show_bug.cgi?id=80797
259
+ // See [WebKit Bug 80797](https://bugs.webkit.org/show_bug.cgi?id=80797)
260
260
  _.max = function(obj, iterator, context) {
261
261
  if (!iterator && _.isArray(obj) && obj[0] === +obj[0] && obj.length < 65535) {
262
262
  return Math.max.apply(Math, obj);
@@ -265,7 +265,7 @@
265
265
  var result = {computed : -Infinity, value: -Infinity};
266
266
  each(obj, function(value, index, list) {
267
267
  var computed = iterator ? iterator.call(context, value, index, list) : value;
268
- computed >= result.computed && (result = {value : value, computed : computed});
268
+ computed > result.computed && (result = {value : value, computed : computed});
269
269
  });
270
270
  return result.value;
271
271
  };
@@ -325,7 +325,7 @@
325
325
  // An internal function used for aggregate "group by" operations.
326
326
  var group = function(obj, value, context, behavior) {
327
327
  var result = {};
328
- var iterator = lookupIterator(value || _.identity);
328
+ var iterator = lookupIterator(value == null ? _.identity : value);
329
329
  each(obj, function(value, index) {
330
330
  var key = iterator.call(context, value, index, obj);
331
331
  behavior(result, key, value);
@@ -364,7 +364,7 @@
364
364
  return low;
365
365
  };
366
366
 
367
- // Safely convert anything iterable into a real, live array.
367
+ // Safely create a real, live array from anything iterable.
368
368
  _.toArray = function(obj) {
369
369
  if (!obj) return [];
370
370
  if (_.isArray(obj)) return slice.call(obj);
@@ -423,8 +423,11 @@
423
423
 
424
424
  // Internal implementation of a recursive `flatten` function.
425
425
  var flatten = function(input, shallow, output) {
426
+ if (shallow && _.every(input, _.isArray)) {
427
+ return concat.apply(output, input);
428
+ }
426
429
  each(input, function(value) {
427
- if (_.isArray(value)) {
430
+ if (_.isArray(value) || _.isArguments(value)) {
428
431
  shallow ? push.apply(output, value) : flatten(value, shallow, output);
429
432
  } else {
430
433
  output.push(value);
@@ -467,7 +470,7 @@
467
470
  // Produce an array that contains the union: each distinct element from all of
468
471
  // the passed-in arrays.
469
472
  _.union = function() {
470
- return _.uniq(concat.apply(ArrayProto, arguments));
473
+ return _.uniq(_.flatten(arguments, true));
471
474
  };
472
475
 
473
476
  // Produce an array that contains every item shared between all the
@@ -491,11 +494,10 @@
491
494
  // Zip together multiple lists into a single array -- elements that share
492
495
  // an index go together.
493
496
  _.zip = function() {
494
- var args = slice.call(arguments);
495
- var length = _.max(_.pluck(args, 'length'));
497
+ var length = _.max(_.pluck(arguments, "length").concat(0));
496
498
  var results = new Array(length);
497
499
  for (var i = 0; i < length; i++) {
498
- results[i] = _.pluck(args, "" + i);
500
+ results[i] = _.pluck(arguments, '' + i);
499
501
  }
500
502
  return results;
501
503
  };
@@ -575,14 +577,25 @@
575
577
  // Function (ahem) Functions
576
578
  // ------------------
577
579
 
580
+ // Reusable constructor function for prototype setting.
581
+ var ctor = function(){};
582
+
578
583
  // Create a function bound to a given object (assigning `this`, and arguments,
579
584
  // optionally). Delegates to **ECMAScript 5**'s native `Function.bind` if
580
585
  // available.
581
586
  _.bind = function(func, context) {
582
- if (func.bind === nativeBind && nativeBind) return nativeBind.apply(func, slice.call(arguments, 1));
583
- var args = slice.call(arguments, 2);
584
- return function() {
585
- return func.apply(context, args.concat(slice.call(arguments)));
587
+ var args, bound;
588
+ if (nativeBind && func.bind === nativeBind) return nativeBind.apply(func, slice.call(arguments, 1));
589
+ if (!_.isFunction(func)) throw new TypeError;
590
+ args = slice.call(arguments, 2);
591
+ return bound = function() {
592
+ if (!(this instanceof bound)) return func.apply(context, args.concat(slice.call(arguments)));
593
+ ctor.prototype = func.prototype;
594
+ var self = new ctor;
595
+ ctor.prototype = null;
596
+ var result = func.apply(self, args.concat(slice.call(arguments)));
597
+ if (Object(result) === result) return result;
598
+ return self;
586
599
  };
587
600
  };
588
601
 
@@ -599,7 +612,7 @@
599
612
  // all callbacks defined on an object belong to it.
600
613
  _.bindAll = function(obj) {
601
614
  var funcs = slice.call(arguments, 1);
602
- if (funcs.length === 0) funcs = _.functions(obj);
615
+ if (funcs.length === 0) throw new Error("bindAll must be passed function names");
603
616
  each(funcs, function(f) { obj[f] = _.bind(obj[f], obj); });
604
617
  return obj;
605
618
  };
@@ -628,17 +641,23 @@
628
641
  };
629
642
 
630
643
  // Returns a function, that, when invoked, will only be triggered at most once
631
- // during a given window of time.
632
- _.throttle = function(func, wait) {
633
- var context, args, timeout, result;
644
+ // during a given window of time. Normally, the throttled function will run
645
+ // as much as it can, without ever going more than once per `wait` duration;
646
+ // but if you'd like to disable the execution on the leading edge, pass
647
+ // `{leading: false}`. To disable execution on the trailing edge, ditto.
648
+ _.throttle = function(func, wait, options) {
649
+ var context, args, result;
650
+ var timeout = null;
634
651
  var previous = 0;
652
+ options || (options = {});
635
653
  var later = function() {
636
- previous = new Date;
654
+ previous = options.leading === false ? 0 : new Date;
637
655
  timeout = null;
638
656
  result = func.apply(context, args);
639
657
  };
640
658
  return function() {
641
659
  var now = new Date;
660
+ if (!previous && options.leading === false) previous = now;
642
661
  var remaining = wait - (now - previous);
643
662
  context = this;
644
663
  args = arguments;
@@ -647,7 +666,7 @@
647
666
  timeout = null;
648
667
  previous = now;
649
668
  result = func.apply(context, args);
650
- } else if (!timeout) {
669
+ } else if (!timeout && options.trailing !== false) {
651
670
  timeout = setTimeout(later, remaining);
652
671
  }
653
672
  return result;
@@ -659,7 +678,8 @@
659
678
  // N milliseconds. If `immediate` is passed, trigger the function on the
660
679
  // leading edge, instead of the trailing.
661
680
  _.debounce = function(func, wait, immediate) {
662
- var timeout, result;
681
+ var result;
682
+ var timeout = null;
663
683
  return function() {
664
684
  var context = this, args = arguments;
665
685
  var later = function() {
@@ -713,7 +733,6 @@
713
733
 
714
734
  // Returns a function that will only be executed after being called N times.
715
735
  _.after = function(times, func) {
716
- if (times <= 0) return func();
717
736
  return function() {
718
737
  if (--times < 1) {
719
738
  return func.apply(this, arguments);
@@ -729,7 +748,7 @@
729
748
  _.keys = nativeKeys || function(obj) {
730
749
  if (obj !== Object(obj)) throw new TypeError('Invalid object');
731
750
  var keys = [];
732
- for (var key in obj) if (_.has(obj, key)) keys[keys.length] = key;
751
+ for (var key in obj) if (_.has(obj, key)) keys.push(key);
733
752
  return keys;
734
753
  };
735
754
 
@@ -801,7 +820,7 @@
801
820
  each(slice.call(arguments, 1), function(source) {
802
821
  if (source) {
803
822
  for (var prop in source) {
804
- if (obj[prop] == null) obj[prop] = source[prop];
823
+ if (obj[prop] === void 0) obj[prop] = source[prop];
805
824
  }
806
825
  }
807
826
  });
@@ -825,7 +844,7 @@
825
844
  // Internal recursive comparison function for `isEqual`.
826
845
  var eq = function(a, b, aStack, bStack) {
827
846
  // Identical objects are equal. `0 === -0`, but they aren't identical.
828
- // See the Harmony `egal` proposal: http://wiki.ecmascript.org/doku.php?id=harmony:egal.
847
+ // See the [Harmony `egal` proposal](http://wiki.ecmascript.org/doku.php?id=harmony:egal).
829
848
  if (a === b) return a !== 0 || 1 / a == 1 / b;
830
849
  // A strict comparison is necessary because `null == undefined`.
831
850
  if (a == null || b == null) return a === b;
@@ -867,6 +886,13 @@
867
886
  // unique nested structures.
868
887
  if (aStack[length] == a) return bStack[length] == b;
869
888
  }
889
+ // Objects with different constructors are not equivalent, but `Object`s
890
+ // from different frames are.
891
+ var aCtor = a.constructor, bCtor = b.constructor;
892
+ if (aCtor !== bCtor && !(_.isFunction(aCtor) && (aCtor instanceof aCtor) &&
893
+ _.isFunction(bCtor) && (bCtor instanceof bCtor))) {
894
+ return false;
895
+ }
870
896
  // Add the first object to the stack of traversed objects.
871
897
  aStack.push(a);
872
898
  bStack.push(b);
@@ -883,13 +909,6 @@
883
909
  }
884
910
  }
885
911
  } else {
886
- // Objects with different constructors are not equivalent, but `Object`s
887
- // from different frames are.
888
- var aCtor = a.constructor, bCtor = b.constructor;
889
- if (aCtor !== bCtor && !(_.isFunction(aCtor) && (aCtor instanceof aCtor) &&
890
- _.isFunction(bCtor) && (bCtor instanceof bCtor))) {
891
- return false;
892
- }
893
912
  // Deep compare objects.
894
913
  for (var key in a) {
895
914
  if (_.has(a, key)) {
@@ -1013,7 +1032,7 @@
1013
1032
 
1014
1033
  // Run a function **n** times.
1015
1034
  _.times = function(n, iterator, context) {
1016
- var accum = Array(n);
1035
+ var accum = Array(Math.max(0, n));
1017
1036
  for (var i = 0; i < n; i++) accum[i] = iterator.call(context, i);
1018
1037
  return accum;
1019
1038
  };
@@ -1056,10 +1075,10 @@
1056
1075
  };
1057
1076
  });
1058
1077
 
1059
- // If the value of the named property is a function then invoke it;
1060
- // otherwise, return it.
1078
+ // If the value of the named `property` is a function then invoke it with the
1079
+ // `object` as context; otherwise, return it.
1061
1080
  _.result = function(object, property) {
1062
- if (object == null) return null;
1081
+ if (object == null) return void 0;
1063
1082
  var value = object[property];
1064
1083
  return _.isFunction(value) ? value.call(object) : value;
1065
1084
  };
metadata CHANGED
@@ -1,30 +1,27 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: backbone-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
5
- prerelease:
4
+ version: 1.0.0.1
6
5
  platform: ruby
7
6
  authors:
8
7
  - Alexander Flatter
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-05-15 00:00:00.000000000 Z
11
+ date: 2013-07-30 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: rails
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
- - - ! '>='
17
+ - - '>='
20
18
  - !ruby/object:Gem::Version
21
19
  version: 3.0.0
22
20
  type: :runtime
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
- - - ! '>='
24
+ - - '>='
28
25
  - !ruby/object:Gem::Version
29
26
  version: 3.0.0
30
27
  description: Ships backbone and underscore to your Rails 3.1 application through the
@@ -47,27 +44,25 @@ files:
47
44
  - README.md
48
45
  homepage: https://github.com/aflatter/backbone-rails
49
46
  licenses: []
47
+ metadata: {}
50
48
  post_install_message:
51
49
  rdoc_options: []
52
50
  require_paths:
53
51
  - lib
54
52
  required_ruby_version: !ruby/object:Gem::Requirement
55
- none: false
56
53
  requirements:
57
- - - ! '>='
54
+ - - '>='
58
55
  - !ruby/object:Gem::Version
59
56
  version: '0'
60
57
  required_rubygems_version: !ruby/object:Gem::Requirement
61
- none: false
62
58
  requirements:
63
- - - ! '>='
59
+ - - '>='
64
60
  - !ruby/object:Gem::Version
65
61
  version: 1.3.6
66
62
  requirements: []
67
63
  rubyforge_project:
68
- rubygems_version: 1.8.24
64
+ rubygems_version: 2.0.4
69
65
  signing_key:
70
- specification_version: 3
66
+ specification_version: 4
71
67
  summary: backbone and underscore for Rails
72
68
  test_files: []
73
- has_rdoc: