thin_man 0.18.5 → 0.18.6

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: 72b5c248dee6812b1f50b5c11e37e7370728acb3
4
- data.tar.gz: 8be59ece46ab30c0ebfa37e62fbaf0c48ea1e0f0
3
+ metadata.gz: db7333edac6bfd5f257266ca1b832d65cc90a54e
4
+ data.tar.gz: 5a128ea6f98bcfc8a28038fd26d1e4f07006187e
5
5
  SHA512:
6
- metadata.gz: e2c7a10ced9a003c804d8082cb5c8eb38e1fe0e162609d3ccc10175c15154dc31b203aa8a22b3a2b4c5c0b7fc9547051176cb8fd05066e78b29b1cab6cce68e1
7
- data.tar.gz: d3bafcdc3b511341ca319cdefd4f9e8a58b1766ed20d179c85941d672df3f96b57616f31162041b549f64cdd1e23f99fb90869a7dfdc16e30b9c776dc1724f17
6
+ metadata.gz: 5400124078dec9cac9a3caacfb4c102a805a2d6c199a9dd97e76f389f4990f25ea3d713f866f4c242a38e551030a447b66fc3af4b7222975b50bfe2c12c609a6
7
+ data.tar.gz: d56bc1a746c7d35df233618d8c64eefe7a4e77e997df7dd056fb1e2892a10e3373d37c0ade9dd59896843724bf20b10ee99d78b71f416ef10a7290f5c7a2e417
@@ -0,0 +1,95 @@
1
+ // This is a bit heavy for what it does, but should be super-easy to extend/enhance
2
+ if(typeof Class === "undefined"){
3
+ /* Simple JavaScript Inheritance
4
+ * By John Resig http://ejohn.org/
5
+ * MIT Licensed.
6
+ */
7
+ // Inspired by base2 and Prototype
8
+ (function(){
9
+ var initializing = false, fnTest = /xyz/.test(function(){xyz;}) ? /\b_super\b/ : /.*/;
10
+ // The base Class implementation (does nothing)
11
+ this.Class = function(){};
12
+
13
+ // Create a new Class that inherits from this class
14
+ Class.extend = function(prop) {
15
+ var _super = this.prototype;
16
+
17
+ // Instantiate a base class (but only create the instance,
18
+ // don't run the init constructor)
19
+ initializing = true;
20
+ var prototype = new this();
21
+ initializing = false;
22
+
23
+ // Copy the properties over onto the new prototype
24
+ for (var name in prop) {
25
+ // Check if we're overwriting an existing function
26
+ prototype[name] = typeof prop[name] == "function" &&
27
+ typeof _super[name] == "function" && fnTest.test(prop[name]) ?
28
+ (function(name, fn){
29
+ return function() {
30
+ var tmp = this._super;
31
+
32
+ // Add a new ._super() method that is the same method
33
+ // but on the super-class
34
+ this._super = _super[name];
35
+
36
+ // The method only need to be bound temporarily, so we
37
+ // remove it when we're done executing
38
+ var ret = fn.apply(this, arguments);
39
+ this._super = tmp;
40
+
41
+ return ret;
42
+ };
43
+ })(name, prop[name]) :
44
+ prop[name];
45
+ }
46
+
47
+ // The dummy class constructor
48
+ function Class() {
49
+ // All construction is actually done in the init method
50
+ if ( !initializing && this.init )
51
+ this.init.apply(this, arguments);
52
+ }
53
+
54
+ // Populate our constructed prototype object
55
+ Class.prototype = prototype;
56
+
57
+ // Enforce the constructor to be what we expect
58
+ Class.prototype.constructor = Class;
59
+
60
+ // And make this class extendable
61
+ Class.extend = arguments.callee;
62
+
63
+ return Class;
64
+ };
65
+ })();
66
+ }
67
+
68
+ if(typeof console == 'undefined'){
69
+ console = {log: function(msg){alert(msg)}}
70
+ }
71
+ var DebugLogger = Class.extend({
72
+ init: function($debug_settings){
73
+ if($debug_settings.data('logging_on')){
74
+ console.log('Debug logging turned on.')
75
+ this.logging_on = true;
76
+ } else {
77
+ this.logging_on = false;
78
+ }
79
+ },
80
+ log: function(msg){
81
+ if(this.logging_on){
82
+ console.log(msg)
83
+ }
84
+ }
85
+ })
86
+
87
+ debug_logger = {
88
+ log: function(){}
89
+ }
90
+ $(document).ready(function(){
91
+ if($('[data-debug_logger]')){
92
+ jqobj = $('[data-debug_logger]');
93
+ debug_logger = new DebugLogger(jqobj);
94
+ }
95
+ })
@@ -0,0 +1,63 @@
1
+ /* Simple JavaScript Inheritance
2
+ * By John Resig http://ejohn.org/
3
+ * MIT Licensed.
4
+ */
5
+ // Inspired by base2 and Prototype
6
+ (function(){
7
+ var initializing = false, fnTest = /xyz/.test(function(){xyz;}) ? /\b_super\b/ : /.*/;
8
+ // The base Class implementation (does nothing)
9
+ this.Class = function(){};
10
+
11
+ // Create a new Class that inherits from this class
12
+ Class.extend = function(prop) {
13
+ var _super = this.prototype;
14
+
15
+ // Instantiate a base class (but only create the instance,
16
+ // don't run the init constructor)
17
+ initializing = true;
18
+ var prototype = new this();
19
+ initializing = false;
20
+
21
+ // Copy the properties over onto the new prototype
22
+ for (var name in prop) {
23
+ // Check if we're overwriting an existing function
24
+ prototype[name] = typeof prop[name] == "function" &&
25
+ typeof _super[name] == "function" && fnTest.test(prop[name]) ?
26
+ (function(name, fn){
27
+ return function() {
28
+ var tmp = this._super;
29
+
30
+ // Add a new ._super() method that is the same method
31
+ // but on the super-class
32
+ this._super = _super[name];
33
+
34
+ // The method only need to be bound temporarily, so we
35
+ // remove it when we're done executing
36
+ var ret = fn.apply(this, arguments);
37
+ this._super = tmp;
38
+
39
+ return ret;
40
+ };
41
+ })(name, prop[name]) :
42
+ prop[name];
43
+ }
44
+
45
+ // The dummy class constructor
46
+ function Class() {
47
+ // All construction is actually done in the init method
48
+ if ( !initializing && this.init )
49
+ this.init.apply(this, arguments);
50
+ }
51
+
52
+ // Populate our constructed prototype object
53
+ Class.prototype = prototype;
54
+
55
+ // Enforce the constructor to be what we expect
56
+ Class.prototype.constructor = Class;
57
+
58
+ // And make this class extendable
59
+ Class.extend = arguments.callee;
60
+
61
+ return Class;
62
+ };
63
+ })();
@@ -1,3 +1,5 @@
1
+ //= require simple_inheritance
2
+ //= require debug_logger
1
3
  var initThinMan = function(){
2
4
  thin_man = {
3
5
  getSubClass: function(sub_class_name,parent_class){
@@ -32,10 +34,17 @@ var initThinMan = function(){
32
34
  LinkGroup: Class.extend({
33
35
  init: function(name){
34
36
  this.name = name
37
+ this.resetLinks()
38
+ },
39
+ resetLinks: function(){
35
40
  this.links = {}
36
41
  this.current_number = 0
37
42
  },
38
43
  addLink: function(link_submission, sequence_number){
44
+ if(this.links.hasOwnProperty(sequence_number)){
45
+ //If there is already a link with this number, we're starting over with a new list
46
+ this.resetLinks()
47
+ }
39
48
  this.links[sequence_number] = link_submission
40
49
  link_submission.addWatcher(this)
41
50
  if(sequence_number == this.current_number){
@@ -45,7 +54,6 @@ var initThinMan = function(){
45
54
  fire: function(){
46
55
  if(this.links.hasOwnProperty(this.current_number)){
47
56
  this.links[this.current_number].fire()
48
- delete this.links[this.current_number]
49
57
  }
50
58
  },
51
59
  linkCompleted: function(link_submission){
@@ -1,3 +1,3 @@
1
1
  module ThinMan
2
- VERSION = "0.18.5"
2
+ VERSION = "0.18.6"
3
3
  end
@@ -18,6 +18,8 @@ module.exports = function(config) {
18
18
  'test-main.js',
19
19
  {pattern: 'jquery.js'},
20
20
  {pattern: 'jasmine-fixture.js'},
21
+ {pattern: '../../app/assets/javascripts/simple_inheritance.js'},
22
+ {pattern: '../../app/assets/javascripts/debug_logger.js'},
21
23
  {pattern: '../../app/assets/javascripts/thin_man.js'},
22
24
  {pattern: 'spec/helpers/*.js'},
23
25
  {pattern: 'spec/**/*Spec.js', included: false}
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: thin_man
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.18.5
4
+ version: 0.18.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eric Draut, Adam Bialek
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-02-16 00:00:00.000000000 Z
11
+ date: 2017-03-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -88,6 +88,8 @@ extra_rdoc_files: []
88
88
  files:
89
89
  - MIT-LICENSE
90
90
  - Rakefile
91
+ - app/assets/javascripts/debug_logger.js
92
+ - app/assets/javascripts/simple_inheritance.hs
91
93
  - app/assets/javascripts/thin_man.js
92
94
  - lib/tasks/thin_man_tasks.rake
93
95
  - lib/thin_man.rb