class AsciiParadise::Sparky
Constants
- CHECKMARK_SYMBOL
#¶ ↑
CHECKMARK_SYMBOL
¶ ↑#¶ ↑
- DEFAULT_SEPARATOR
#¶ ↑
DEFAULT_SEPARATOR
¶ ↑#¶ ↑
- ENCODING_UTF8
#¶ ↑
ENCODING_UTF8
¶ ↑#¶ ↑
- PROGRESSION_BLOCKS
#¶ ↑
AsciiParadise::Sparky::PROGRESSION_BLOCKS
¶ ↑These progression blocks are useful to “build up” to something.
#¶ ↑
- SNOWMAN
#¶ ↑
SNOWMAN
¶ ↑#¶ ↑
Public Class Methods
new(i)
click to toggle source
Public Instance Methods
format() { |tick, original_numbers, index| ... }
click to toggle source
#¶ ↑
format¶ ↑
Formats all the ticks in the given Sparkline with a given block, returns itself.
Example:
Let's say you have an Array of open and closed issues and want to format it so the open ones are red and the closed ones are green, so you can quickly see how you are doing. This can be done via the colour component of “module Colours”. An example can be found at the end of the file here.
#¶ ↑
# File lib/ascii_paradise/sparky/sparkline.rb, line 50 def format @ticks = @ticks.map.with_index { |tick, index| yield(tick, @original_numbers[index], index) } self # Return Sparky itself too. end
lightgreen(i)
click to toggle source
normalize_numbers(i)
click to toggle source
#¶ ↑
normalize_numbers
¶ ↑
Returns the normalized equivalent of a given list
normalize_numbers([3, 4, 7]) # => [0, 1, 4]
@return [Fixnum] the normalized equivalent of the given _numbers
#¶ ↑
# File lib/ascii_paradise/sparky/sparkline.rb, line 67 def normalize_numbers(i) numbers = i.map(&:to_i) min = numbers.min numbers.map { |n| n - min } end
reset()
click to toggle source
step_height(i)
click to toggle source
steps()
click to toggle source
to_s(sep = nil)
click to toggle source