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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c95e929d69cab1b4cbaafa7a6a143de064b6a91b
4
- data.tar.gz: e7aaa6685c613f0ad95841690b4c8f5f1569af2d
3
+ metadata.gz: 13933a0323bc68a37ae398dbe0de249769d57d0e
4
+ data.tar.gz: 96bd30bbd54ec4c09327e920ceb0046f47b9f77a
5
5
  SHA512:
6
- metadata.gz: 59167787dafcbead72b2b489c7aaa125fc0f9e6fb81365ffdb34ba03b1a684c1d8e83eb64f63e203a3fe51caddbb86831549d3c1e7ee931b972a675c017965c4
7
- data.tar.gz: 6fc3c59056ecd29cdae48212c186c299e0449ee180cef5645444fe1f56321b2ff4eff344378624ada3a220967e53d937c35ec59a6949649f50a829cbac05c520
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
- require 'bundler'
4
- begin
5
- Bundler.require
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)
@@ -6,14 +6,18 @@ module Sparkr
6
6
  DEFAULT_SEPARATOR = ''
7
7
 
8
8
  def initialize(_numbers)
9
- @original_numbers = _numbers
9
+ if _numbers.empty?
10
+ @ticks = []
11
+ else
12
+ @original_numbers = _numbers
10
13
 
11
- numbers = normalize_numbers(_numbers)
12
- one_step = step_height(numbers)
14
+ numbers = normalize_numbers(_numbers)
15
+ one_step = step_height(numbers)
13
16
 
14
- @ticks = numbers.map do |n|
15
- index = (n / one_step).to_i
16
- TICKS[index]
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
 
@@ -1,5 +1,5 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  module Sparkr
4
- VERSION = "0.3.1"
4
+ VERSION = "0.3.2"
5
5
  end
@@ -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.1
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-29 00:00:00.000000000 Z
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.3
87
+ rubygems_version: 2.0.6
88
88
  signing_key:
89
89
  specification_version: 4
90
90
  summary: '["ASCII", "Sparklines", "in", "Ruby"]'