simple_chartjs 1.0.4 → 1.0.5

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: 698712eaf0499d485dcee531909bf0efa8f445ae
4
- data.tar.gz: 995eeccd7a40c1075802cbcc8e9dac241b76245c
3
+ metadata.gz: 475d3c2bc4e116c303160ebe6d7ee481a327ec9f
4
+ data.tar.gz: 7ac69774f198f1d39af5995446d6862d24eb6761
5
5
  SHA512:
6
- metadata.gz: 4da1f38b5e4817d655f1665e721096ae297f2afe603213272895fc2ead29ca111d8116e0000e36b08427bd5620350961b88011b791d4e5a8a62ccb4479f3459f
7
- data.tar.gz: aeb03c49cf4b030caa7f7b7ea89ddc30ec94f22a37d2f2d41af27b8930f364ac3bb6f035db76f6b2fb805d31b8ff2430c858d5d2a0c519c4debc0b4253e0e6c9
6
+ metadata.gz: 95aaf8f8d5fc8e7b88ef3a8116cf628b2f3a01ea425c8e85cde74109f0157a8db8601cba47667e8f4f9de49ff57ec655e550d39301b2738fd9b820371f2629a1
7
+ data.tar.gz: add0166feba243f011faa403ab1979d4b2baeaa4b6c59ed9acb19172d98253860ccfa387ad9a27512ab589c172803d0c4be90cf72133edeb97294c5a0a60e3b6
data/.gitignore CHANGED
@@ -8,6 +8,7 @@
8
8
  /spec/reports/
9
9
  /tmp/
10
10
  /**/.DS_Store
11
+ tags
11
12
 
12
13
  # rspec failure tracking
13
14
  .rspec_status
@@ -19,17 +19,17 @@ SimpleChart.prototype.createChart = function() {
19
19
  if(xhr.status === 200) {
20
20
  chart.buildChart(xhr.response);
21
21
  } else {
22
- chart.ctx.innerText = "Failed to Load: An Error has Occured"
23
- chart.ctx.style.color = "red"
22
+ chart.ctx.innerText = "Failed to Load: An Error has Occured";
23
+ chart.ctx.style.color = "red";
24
24
  }
25
25
  }
26
- }
26
+ };
27
27
  xhr.send();
28
- }
28
+ };
29
29
 
30
30
  SimpleChart.prototype.buildChart = function(data) {
31
31
  var data = JSON.parse(data);
32
- [this.datasetProperties, this.configurationOptions] = this.chartConfiguration();
32
+ this.chartConfiguration();
33
33
 
34
34
  this.ctx.innerHTML = this.canvas();
35
35
  var canvas = this.ctx.getElementsByTagName('canvas')[0];
@@ -39,23 +39,19 @@ SimpleChart.prototype.buildChart = function(data) {
39
39
  data: this.formatChartData(data),
40
40
  options: this.configurationOptions
41
41
  });
42
- }
42
+ };
43
43
 
44
44
  SimpleChart.prototype.chartConfiguration = function() {
45
- var optionMethod = this.ctx.dataset['options']
45
+ var optionMethod = this.ctx.dataset.options;
46
46
 
47
47
  if(typeof(optionMethod) != "undefined" && typeof(this[this.convertToCamelCase(optionMethod) + "Options"]) != "undefined") {
48
- return [
49
- this.configureOption('datasetProperties', JSON.parse(this.datasetProperties), optionMethod),
50
- this.configureOption('options', JSON.parse(this.configurationOptions), optionMethod)
51
- ]
48
+ this.datasetProperties = this.configureOption('datasetProperties', JSON.parse(this.datasetProperties), optionMethod);
49
+ this.configurationOptions = this.configureOption('options', JSON.parse(this.configurationOptions), optionMethod);
52
50
  } else {
53
- return [
54
- this.formatRubyObject(JSON.parse(this.datasetProperties)),
55
- this.formatRubyObject(JSON.parse(this.configurationOptions))
56
- ]
51
+ this.datasetProperties = this.formatRubyObject(JSON.parse(this.datasetProperties));
52
+ this.configurationOptions = this.formatRubyObject(JSON.parse(this.configurationOptions));
57
53
  }
58
- }
54
+ };
59
55
 
60
56
  SimpleChart.prototype.configureOption = function(option_name, current_options, optionMethod) {
61
57
  var options = this[this.convertToCamelCase(optionMethod) + "Options"]()[option_name];
@@ -64,11 +60,11 @@ SimpleChart.prototype.configureOption = function(option_name, current_options, o
64
60
  return this.mergeObjects(
65
61
  options,
66
62
  this.formatRubyObject(current_options)
67
- )
63
+ );
68
64
  } else {
69
- return this.formatRubyObject(current_options)
65
+ return this.formatRubyObject(current_options);
70
66
  }
71
- }
67
+ };
72
68
 
73
69
  SimpleChart.prototype.formatChartData = function(data) {
74
70
  var chartData = data;
@@ -92,14 +88,14 @@ SimpleChart.prototype.formatChartData = function(data) {
92
88
  }
93
89
 
94
90
  return chartData;
95
- }
91
+ };
96
92
 
97
93
  SimpleChart.prototype.formatArrayRubyObjects = function(array) {
98
94
  for (var i = 0; i < array.length; i++) {
99
95
  this.formatRubyObject(array[i]);
100
96
  }
101
97
  return array;
102
- }
98
+ };
103
99
 
104
100
  SimpleChart.prototype.formatRubyObject = function(object) {
105
101
  for (property in object) {
@@ -115,18 +111,18 @@ SimpleChart.prototype.formatRubyObject = function(object) {
115
111
  }
116
112
  }
117
113
  return object;
118
- }
114
+ };
119
115
 
120
116
  SimpleChart.prototype.convertToCamelCase = function(string) {
121
117
  return string.replace(/[-_]([a-z])/, function(_, letter) {
122
118
  return letter.toUpperCase();
123
119
  });
124
- }
120
+ };
125
121
 
126
122
  SimpleChart.prototype.mergeObjects = function(obj, src) {
127
123
  Object.keys(src).forEach(function(key) { obj[key] = src[key]; });
128
124
  return obj;
129
- }
125
+ };
130
126
 
131
127
  SimpleChart.prototype.canvas = function() {
132
128
  var canvas = '<canvas';
@@ -135,4 +131,4 @@ SimpleChart.prototype.canvas = function() {
135
131
  canvas += '></canvas>';
136
132
 
137
133
  return canvas;
138
- }
134
+ };
@@ -1,3 +1,3 @@
1
1
  module SimpleChartjs
2
- VERSION = '1.0.4'.freeze
2
+ VERSION = '1.0.5'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: simple_chartjs
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.4
4
+ version: 1.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Harry Venables
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-12-20 00:00:00.000000000 Z
11
+ date: 2017-12-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler