sparkr 0.3.1 → 0.3.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/sparkr +4 -5
- data/lib/sparkr/sparkline.rb +10 -6
- data/lib/sparkr/version.rb +1 -1
- data/test/sparkr/sparkline_test.rb +5 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 13933a0323bc68a37ae398dbe0de249769d57d0e
|
4
|
+
data.tar.gz: 96bd30bbd54ec4c09327e920ceb0046f47b9f77a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6a75738f6a5420adba764234f409003e3f6d0e9db0de3f6217b316bb596f78f97a82f62b364656170ba88a24f819c7b74e388c3611c63021b649a0f4239b0369
|
7
|
+
data.tar.gz: 8f21ae8ee6f677e6c2446045fa081a913cbda07756f00db5d3ebdeed9ac3daddcf38e60bb15b74f83747434d89a7311ffde5811d7d9e5ee5421485fb3d36558b
|
data/bin/sparkr
CHANGED
@@ -1,11 +1,10 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
rescue Bundler::GemfileNotFound
|
7
|
-
require 'sparkr'
|
3
|
+
path = __FILE__
|
4
|
+
while File.symlink?(path)
|
5
|
+
path = File.expand_path(File.readlink(path), File.dirname(path))
|
8
6
|
end
|
7
|
+
$:.unshift(File.join(File.dirname(File.expand_path(path)), '..', 'lib'))
|
9
8
|
|
10
9
|
require 'sparkr'
|
11
10
|
Sparkr::CLI.run(*ARGV)
|
data/lib/sparkr/sparkline.rb
CHANGED
@@ -6,14 +6,18 @@ module Sparkr
|
|
6
6
|
DEFAULT_SEPARATOR = ''
|
7
7
|
|
8
8
|
def initialize(_numbers)
|
9
|
-
|
9
|
+
if _numbers.empty?
|
10
|
+
@ticks = []
|
11
|
+
else
|
12
|
+
@original_numbers = _numbers
|
10
13
|
|
11
|
-
|
12
|
-
|
14
|
+
numbers = normalize_numbers(_numbers)
|
15
|
+
one_step = step_height(numbers)
|
13
16
|
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
+
@ticks = numbers.map do |n|
|
18
|
+
index = (n / one_step).to_i
|
19
|
+
TICKS[index]
|
20
|
+
end
|
17
21
|
end
|
18
22
|
end
|
19
23
|
|
data/lib/sparkr/version.rb
CHANGED
@@ -4,6 +4,11 @@ require File.expand_path(File.dirname(__FILE__) + '/../test_helper')
|
|
4
4
|
|
5
5
|
describe ::Sparkr::Sparkline do
|
6
6
|
|
7
|
+
it "format should work with an empty array" do
|
8
|
+
sparkline = Sparkr::Sparkline.new([])
|
9
|
+
assert_equal '', sparkline.to_s
|
10
|
+
end
|
11
|
+
|
7
12
|
it "format should work with arity == 2" do
|
8
13
|
sparkline = Sparkr::Sparkline.new([5.5,20])
|
9
14
|
sparkline.format do |tick, number|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sparkr
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- René Föhring
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-01-
|
11
|
+
date: 2014-01-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -84,7 +84,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
84
84
|
version: '0'
|
85
85
|
requirements: []
|
86
86
|
rubyforge_project:
|
87
|
-
rubygems_version: 2.0.
|
87
|
+
rubygems_version: 2.0.6
|
88
88
|
signing_key:
|
89
89
|
specification_version: 4
|
90
90
|
summary: '["ASCII", "Sparklines", "in", "Ruby"]'
|