Skip to content

Commit

Permalink
Add examples/ folder
Browse files Browse the repository at this point in the history
  • Loading branch information
rrrene committed Feb 2, 2014
1 parent 30d4039 commit 067bcb4
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
7 changes: 7 additions & 0 deletions examples/issues.rb
@@ -0,0 +1,7 @@
require 'sparkr'

open_issue_count = 3
closed_issue_count = 13

list = [open_issue_count, closed_issue_count]
puts "Issues: " + Sparkr.sparkline(list)
24 changes: 24 additions & 0 deletions examples/issues_colored.rb
@@ -0,0 +1,24 @@
require 'sparkr'
#
# You need Term::ANSIColor for this example:
#
# $ gem install term-ansicolor
#
require 'term/ansicolor'

class String
include Term::ANSIColor
end

open_issue_count = 3
closed_issue_count = 13

list = [open_issue_count, closed_issue_count]
sparkline = Sparkr.sparkline(list) do |tick, count, index|
if index == 0
tick.color(:red)
else
tick.color(:green)
end
end
puts "Issues: " + sparkline

0 comments on commit 067bcb4

Please sign in to comment.