spark_pr 0.1.1 → 0.1.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ffc0fc1819947705d2dae640c79265fdf10e3751
4
- data.tar.gz: d9b6d5fcab20b25f68f6abc956e9b2c6df95e3cb
3
+ metadata.gz: cd5c72348a78af4e2e234f262e79285782598c55
4
+ data.tar.gz: 37bebe7dc93c8c943219f88644fb69cde8cee8ba
5
5
  SHA512:
6
- metadata.gz: 5184a383ac5564c24efbd34fa4bca965385e3ba7b24377de1ded68275b1cbdaee2afbb6644f49602796f2ec55e5b5f4d64560d69a56e653ea17142e2c70dd8f0
7
- data.tar.gz: 4596532085b96bed1002f975729369195f45a57142e331883c6a3e9b554d07a6c7f1228f23fd73d0ec30b1190523977e5c32c7f76264dd3c4f73ab49443ac795
6
+ metadata.gz: ecd34fcc1e4537d9571526ed0c7f141ea5a137fc91103147077d3b0f6e5a5f358053d5e4e9bfe8deeb595caf15edb510339003e45e052b2bb0726a8845201091
7
+ data.tar.gz: dce7a5b20a5de48b87ff647c4e73a50b11f774d9153c4a3d359884c5784ecab2d13800715c63f514a9b4924209c4f8d2ce67d1c676e894e3ad2ef1d1924ce3d4
@@ -38,7 +38,12 @@ class Spark
38
38
 
39
39
  o[:width] ||= (results.size-1)*o[:step] + 5
40
40
 
41
- c = SparkCanvas.new(o[:width], o[:height])
41
+ c = if o[:base_color]
42
+ SparkCanvas.new(o[:width], o[:height], o[:base_color])
43
+ else
44
+ SparkCanvas.new(o[:width], o[:height])
45
+ end
46
+
42
47
 
43
48
  results = normalize(results, o[:normalize])
44
49
  fac = c.height-5
@@ -80,7 +85,11 @@ class Spark
80
85
 
81
86
  o[:width] ||= results.size*2-1
82
87
 
83
- c = SparkCanvas.new(o[:width], o[:height])
88
+ c = if o[:base_color]
89
+ SparkCanvas.new(o[:width], o[:height], o[:base_color])
90
+ else
91
+ SparkCanvas.new(o[:width], o[:height])
92
+ end
84
93
 
85
94
  results = normalize(results, o[:normalize])
86
95
  fac = c.height-4
@@ -103,14 +112,14 @@ class Spark
103
112
  # convenience methods
104
113
  def self.plot( results, options = {} )
105
114
  spark = Spark.new(options)
106
- type = opts.delete(:type) || :smooth
107
- spark.send(type, results, o).to_png
115
+ type = spark.opts.delete(:type) || :smooth
116
+ spark.send(type, results).to_png
108
117
  end
109
118
 
110
119
  def self.data_uri( results, options = {} )
111
120
  spark = Spark.new(options)
112
121
  type = spark.opts.delete(:type) || :smooth
113
- spark.send(type, results )
122
+ spark.send(type, results)
114
123
  spark.data_uri
115
124
  end
116
125
  end
@@ -13,11 +13,11 @@ class SparkCanvas
13
13
  attr_accessor :color
14
14
  attr_reader :width, :height
15
15
 
16
- def initialize(width,height)
16
+ def initialize(width,height,base_color=[0xFF,0xFF,0xFF])
17
17
  @canvas = []
18
18
  @height = height
19
19
  @width = width
20
- height.times{ @canvas << [[0xFF,0xFF,0xFF]]*width }
20
+ height.times{ @canvas << [base_color]*width }
21
21
  @color = [0,0,0,0xFF] #RGBA
22
22
  end
23
23
 
@@ -1,3 +1,3 @@
1
1
  module SparkPr
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: spark_pr
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Thomas Fuchs
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: exe
12
12
  cert_chain: []
13
- date: 2016-04-07 00:00:00.000000000 Z
13
+ date: 2016-04-13 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: bundler