Class: Hackmac::Graph

Inherits:
Object
  • Object
show all
Includes:
Term::ANSIColor
Defined in:
lib/hackmac/graph.rb

Instance Method Summary collapse

Constructor Details

#initialize(title:, value: -> i { 0 }, format_value: nil, sleep: nil, color: nil) ⇒ Graph

Returns a new instance of Graph.



7
8
9
10
11
12
13
14
15
# File 'lib/hackmac/graph.rb', line 7

def initialize(title:, value: -> i { 0 }, format_value: nil, sleep: nil, color: nil)
  @title        = title
  @value        = value
  @format_value = format_value
  @sleep        = sleep
  @continue     = false
  @data         = []
  @color        = color
end

Instance Method Details

#start ⇒ Object



17
18
19
20
21
22
23
# File 'lib/hackmac/graph.rb', line 17

def start
  install_handlers
  full_reset
  perform hide_cursor
  @continue = true
  start_loop
end

#stop ⇒ Object



25
26
27
28
# File 'lib/hackmac/graph.rb', line 25

def stop
  full_reset
  @continue = false
end