Browse files

Add examples/ folder

  • Loading branch information...
1 parent 30d4039 commit 067bcb4135a74e92ab86668eb40c2d53afb3daeb @rrrene committed Feb 2, 2014
Showing with 31 additions and 0 deletions.
  1. +7 −0 examples/issues.rb
  2. +24 −0 examples/issues_colored.rb
View
7 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)
View
24 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.