rubyspark 0.0.3 → 0.0.4

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,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- M2Q1MzIwZTFjOTc2ZTAzZDI5N2I3M2Y2MjdjNTkyYzhjMDNiZTgzMw==
4
+ YTExM2Q5YjI3YTU2NjMxMDlhYjJiODI1ODhmM2JmMzBlZmU4NWZhMg==
5
5
  data.tar.gz: !binary |-
6
- NWQyMzYxN2IwMWUyNDJlNzM1OGE3Y2JkNDY4ZWQ1YjIzZTVkNWI0OQ==
6
+ ZTMxMTlhMGQ0MDc5MzRkNGMxOGE3MmFiNzAyYmY4Mjg5ZGViM2UxMw==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- ZTk5ZTY3MDNlMTM2MGNjZGJhMGQyNDBmMjZjZTljMmZmZGVhMjE5ZmQzMGE2
10
- Y2E2YTMwZGNmYmNlMDFkYmNhYTFlNzc5YTFiNTk0MDY0MGNjZWJkZjExNmQ1
11
- Y2QzYWEyMTFmYTk1ZDVmYzViYzg4YzUxZmM5MGNhZDI4ODJlM2Q=
9
+ ZGE3NTEwNDFlZDE5MTllZmYwZDc3ZGY2YmU3OTZhOWNjOGU0Y2VmZTM1N2Iz
10
+ OGRkMDdmZDdjOTBkZDUxMDc0NzYwNjRiM2EzMTBhYTllYjNkZmQxZDk4NDM0
11
+ ZWM2NmQ0YzY1NGQ1OTU4ZWU3M2E1YjUwNDA4YzUzOTIwY2IzODI=
12
12
  data.tar.gz: !binary |-
13
- NTk1MDhlYmRjY2IzM2Y0NTRkYjRmMWMzNDIyMTJkMjA4NzBmNTZhNTRjYjky
14
- ZWZiOWMwNjQ4NjFiODdkYjNjOGJmZThkNjYzZTIxYjI3YTg0YmViYTY1MDJk
15
- NGRlYjQ0NTgyZGJhMWE3NzE2ZjU1MzkxZmM0MThhNWU1MzljYzU=
13
+ MDUxZGI0Yzg3NWMwMTFiMGY0YjZkMzA4ZmQzOTE5MGFkZmM1Mjk1OGI1MjNm
14
+ YjkyMzFkMjc1MjAwZDNjNTEwZmZlMjBhYTVjZjg4NWExYzZmNGM1NzQ2MDk5
15
+ OTBmZTQ0NDRmZmRlODM3NTM5MjFlNjdmOWJjMzNmMjEyYmMwODY=
@@ -1,4 +1,5 @@
1
1
  language: ruby
2
+ cache: bundler
2
3
  rvm:
3
4
  - 2.1.0
4
5
  - ruby-head
data/README.md CHANGED
@@ -1,5 +1,4 @@
1
- # Rubyspark
2
- [![Build Status](https://travis-ci.org/tevren/rubyspark.svg?branch=master)](https://travis-ci.org/tevren/rubyspark)
1
+ # Rubyspark [![Build Status](https://travis-ci.org/tevren/rubyspark.svg?branch=master)](https://travis-ci.org/tevren/rubyspark) [![Gem Version](https://badge.fury.io/rb/rubyspark.svg)](http://badge.fury.io/rb/rubyspark) [![Code Climate](https://codeclimate.com/github/tevren/rubyspark/badges/gpa.svg)](https://codeclimate.com/github/tevren/rubyspark) [![Test Coverage](https://codeclimate.com/github/tevren/rubyspark/badges/coverage.svg)](https://codeclimate.com/github/tevren/rubyspark)
3
2
 
4
3
  A ruby port of [Spark](http://zachholman.com/spark/)
5
4
 
@@ -1,16 +1,26 @@
1
1
  require 'rubyspark/version'
2
2
  module Rubyspark
3
3
  class Spark
4
+ # a new instance of RubySpark::Spark
5
+ #
6
+ # @param data [Array] An array of numbers to build the graph from
4
7
  def initialize data = []
5
8
  @data = []
6
9
  data.cycle(1) { |x| @data.push(x.to_f) }
7
10
  graphit
8
11
  end
9
12
 
13
+ # Compute x's location in relation to the max
14
+ #
15
+ # @param x [Fixnum] data point from input array
16
+ # @param distance [Fixnum] the max/size of ticks array
17
+ # @return [Fixnum] the position on the ticks array for the value of x
10
18
  def compute x, distance
11
19
  (x / distance).round - 1
12
20
  end
13
21
 
22
+ # Graphs data, takes data and maps it against flat map of ticks
23
+ # @return [String] sparkline output in STDOUT
14
24
  def graphit
15
25
  ticks = %w(▁ ▂ ▃ ▄ ▅ ▆ ▇)
16
26
  distance = @data.max.to_f / ticks.size
@@ -1,3 +1,3 @@
1
1
  module Rubyspark
2
- VERSION = '0.0.3'
2
+ VERSION = '0.0.4'
3
3
  end
@@ -22,4 +22,6 @@ Gem::Specification.new do |spec|
22
22
  spec.add_development_dependency 'rake'
23
23
  spec.add_development_dependency 'rubocop'
24
24
  spec.add_development_dependency 'rspec'
25
+ spec.add_development_dependency 'codeclimate-test-reporter'
26
+ spec.add_development_dependency 'yard'
25
27
  end
@@ -1,2 +1,4 @@
1
+ require 'codeclimate-test-reporter'
2
+ CodeClimate::TestReporter.start
1
3
  require 'rspec'
2
4
  require_relative '../lib/rubyspark'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubyspark
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Anurag Mohanty
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-12-19 00:00:00.000000000 Z
11
+ date: 2014-12-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -66,6 +66,34 @@ dependencies:
66
66
  - - ! '>='
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: codeclimate-test-reporter
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ! '>='
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ! '>='
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: yard
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ! '>='
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ! '>='
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
69
97
  description: A ruby port of (spark)[https://github.com/holman/spark])
70
98
  email:
71
99
  - tevren@gmail.com