set_builder 1.0.2 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/{assets → lib/assets}/javascripts/set_builder.js +105 -0
- data/lib/set_builder.rb +1 -0
- data/lib/set_builder/engine.rb +4 -0
- data/lib/set_builder/version.rb +1 -1
- metadata +3 -3
- data/assets/javascripts/array.js +0 -100
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a4ee4be1ca6fe188bd97be3b9799e760f0323964
|
4
|
+
data.tar.gz: 7511cc628d027af339b9b1bc16030ad7ee1f370d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3ff3004bdd8f7200e87daeb8c9d7b3cafb3856e112f967666210dac89f91bbb570ce510bae2e8be6cfe0fbf3524990f249e3be7e6e0bb239b2c72460b4e88bc3
|
7
|
+
data.tar.gz: 2f7e8c30215b01bffa2a2d8753fab4e9e0943302f4944aa90ebeb3d414827ae68fae4c67d3acf0104e90ed14bcad36c265b8a6a77ec07a145f87c29a83495886
|
@@ -413,3 +413,108 @@ SetBuilder.Traits = function(_raw_data) {
|
|
413
413
|
}
|
414
414
|
|
415
415
|
};
|
416
|
+
|
417
|
+
|
418
|
+
|
419
|
+
|
420
|
+
|
421
|
+
/*
|
422
|
+
Extensions to core objects to provide Ruby-like idioms
|
423
|
+
===========================================================
|
424
|
+
*/
|
425
|
+
|
426
|
+
if(!Object.keys) {
|
427
|
+
Object.keys = function(o) {
|
428
|
+
var keys = [];
|
429
|
+
for(key in o) {
|
430
|
+
keys.push(key);
|
431
|
+
}
|
432
|
+
return keys;
|
433
|
+
}
|
434
|
+
}
|
435
|
+
|
436
|
+
|
437
|
+
|
438
|
+
//
|
439
|
+
// .toSentence
|
440
|
+
//
|
441
|
+
if(!Array.prototype.toSentence) {
|
442
|
+
Array.prototype.toSentence = function() {
|
443
|
+
switch(this.length) {
|
444
|
+
case 0:
|
445
|
+
return '';
|
446
|
+
case 1:
|
447
|
+
return this[0].toString();
|
448
|
+
case 2:
|
449
|
+
return this[0].toString() + ' and ' + this[1].toString();
|
450
|
+
default:
|
451
|
+
return this.slice(0, -1).join(', ') + ', and ' + this[this.length - 1].toString();
|
452
|
+
}
|
453
|
+
}
|
454
|
+
}
|
455
|
+
|
456
|
+
|
457
|
+
|
458
|
+
//
|
459
|
+
// .dup
|
460
|
+
//
|
461
|
+
Array.prototype.__dup = function(fn) {
|
462
|
+
return this.slice(0);
|
463
|
+
}
|
464
|
+
if(!Array.prototype.dup) Array.prototype.dup = Array.prototype.__dup;
|
465
|
+
|
466
|
+
|
467
|
+
|
468
|
+
//
|
469
|
+
// .each
|
470
|
+
// Distinct from Prototype's each which catches exceptions (ew!)
|
471
|
+
// so that if Prototype defines each, I can still call __each
|
472
|
+
//
|
473
|
+
Array.prototype.__each = function(fn) {
|
474
|
+
for(var i=0, len=this.length; i<len; i++) {
|
475
|
+
fn(this[i], i);
|
476
|
+
}
|
477
|
+
}
|
478
|
+
if(!Array.prototype.each) Array.prototype.each = Array.prototype.__each;
|
479
|
+
|
480
|
+
|
481
|
+
|
482
|
+
//
|
483
|
+
// .collect
|
484
|
+
//
|
485
|
+
Array.prototype.__collect = function(fn) {
|
486
|
+
var new_array = [];
|
487
|
+
for(var i=0; i<this.length; i++) {
|
488
|
+
new_array.push(fn(this[i]));
|
489
|
+
}
|
490
|
+
return new_array;
|
491
|
+
}
|
492
|
+
if(!Array.prototype.collect) Array.prototype.collect = Array.prototype.__collect;
|
493
|
+
|
494
|
+
|
495
|
+
|
496
|
+
//
|
497
|
+
// .inject
|
498
|
+
//
|
499
|
+
Array.prototype.__inject = function(memo, fn) {
|
500
|
+
for(var i=0; i<this.length; i++) {
|
501
|
+
memo = fn(memo, this[i]);
|
502
|
+
}
|
503
|
+
return memo;
|
504
|
+
}
|
505
|
+
if(!Array.prototype.inject) Array.prototype.inject = Array.prototype.__inject;
|
506
|
+
|
507
|
+
|
508
|
+
|
509
|
+
//
|
510
|
+
// .find
|
511
|
+
//
|
512
|
+
Array.prototype.__find = function(fn) {
|
513
|
+
for(var i=0; i<this.length; i++) {
|
514
|
+
if(fn(this[i])) {
|
515
|
+
return this[i];
|
516
|
+
}
|
517
|
+
}
|
518
|
+
return null;
|
519
|
+
}
|
520
|
+
if(!Array.prototype.find) Array.prototype.find = Array.prototype.__find;
|
data/lib/set_builder.rb
CHANGED
data/lib/set_builder/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: set_builder
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bob Lail
|
@@ -78,12 +78,12 @@ files:
|
|
78
78
|
- MIT-LICENSE
|
79
79
|
- README.md
|
80
80
|
- Rakefile
|
81
|
-
- assets/javascripts/array.js
|
82
|
-
- assets/javascripts/set_builder.js
|
83
81
|
- init.rb
|
84
82
|
- install.rb
|
83
|
+
- lib/assets/javascripts/set_builder.js
|
85
84
|
- lib/set_builder.rb
|
86
85
|
- lib/set_builder/constraint.rb
|
86
|
+
- lib/set_builder/engine.rb
|
87
87
|
- lib/set_builder/modifier.rb
|
88
88
|
- lib/set_builder/modifier/adverb.rb
|
89
89
|
- lib/set_builder/modifier/base.rb
|
data/assets/javascripts/array.js
DELETED
@@ -1,100 +0,0 @@
|
|
1
|
-
/*
|
2
|
-
Extensions to core objects to provide Ruby-like idioms
|
3
|
-
===========================================================
|
4
|
-
*/
|
5
|
-
|
6
|
-
if(!Object.keys) {
|
7
|
-
Object.keys = function(o) {
|
8
|
-
var keys = [];
|
9
|
-
for(key in o) {
|
10
|
-
keys.push(key);
|
11
|
-
}
|
12
|
-
return keys;
|
13
|
-
}
|
14
|
-
}
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
//
|
19
|
-
// .toSentence
|
20
|
-
//
|
21
|
-
if(!Array.prototype.toSentence) {
|
22
|
-
Array.prototype.toSentence = function() {
|
23
|
-
switch(this.length) {
|
24
|
-
case 0:
|
25
|
-
return '';
|
26
|
-
case 1:
|
27
|
-
return this[0].toString();
|
28
|
-
case 2:
|
29
|
-
return this[0].toString() + ' and ' + this[1].toString();
|
30
|
-
default:
|
31
|
-
return this.slice(0, -1).join(', ') + ', and ' + this[this.length - 1].toString();
|
32
|
-
}
|
33
|
-
}
|
34
|
-
}
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
//
|
39
|
-
// .dup
|
40
|
-
//
|
41
|
-
Array.prototype.__dup = function(fn) {
|
42
|
-
return this.slice(0);
|
43
|
-
}
|
44
|
-
if(!Array.prototype.dup) Array.prototype.dup = Array.prototype.__dup;
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
//
|
49
|
-
// .each
|
50
|
-
// Distinct from Prototype's each which catches exceptions (ew!)
|
51
|
-
// so that if Prototype defines each, I can still call __each
|
52
|
-
//
|
53
|
-
Array.prototype.__each = function(fn) {
|
54
|
-
for(var i=0, len=this.length; i<len; i++) {
|
55
|
-
fn(this[i], i);
|
56
|
-
}
|
57
|
-
}
|
58
|
-
if(!Array.prototype.each) Array.prototype.each = Array.prototype.__each;
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
//
|
63
|
-
// .collect
|
64
|
-
//
|
65
|
-
Array.prototype.__collect = function(fn) {
|
66
|
-
var new_array = [];
|
67
|
-
for(var i=0; i<this.length; i++) {
|
68
|
-
new_array.push(fn(this[i]));
|
69
|
-
}
|
70
|
-
return new_array;
|
71
|
-
}
|
72
|
-
if(!Array.prototype.collect) Array.prototype.collect = Array.prototype.__collect;
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
//
|
77
|
-
// .inject
|
78
|
-
//
|
79
|
-
Array.prototype.__inject = function(memo, fn) {
|
80
|
-
for(var i=0; i<this.length; i++) {
|
81
|
-
memo = fn(memo, this[i]);
|
82
|
-
}
|
83
|
-
return memo;
|
84
|
-
}
|
85
|
-
if(!Array.prototype.inject) Array.prototype.inject = Array.prototype.__inject;
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
//
|
90
|
-
// .find
|
91
|
-
//
|
92
|
-
Array.prototype.__find = function(fn) {
|
93
|
-
for(var i=0; i<this.length; i++) {
|
94
|
-
if(fn(this[i])) {
|
95
|
-
return this[i];
|
96
|
-
}
|
97
|
-
}
|
98
|
-
return null;
|
99
|
-
}
|
100
|
-
if(!Array.prototype.find) Array.prototype.find = Array.prototype.__find;
|