Class: FunCi::Tui::Spinner

Inherits:
Object
  • Object
show all
Defined in:
lib/fun_ci/tui/spinner.rb

Constant Summary collapse

BRAILLE_FRAMES =
%W[\u2800 \u2801 \u2803 \u2807 \u280F \u281F \u283F \u287F].freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize ⇒ Spinner

Returns a new instance of Spinner.



10
11
12
13
# File 'lib/fun_ci/tui/spinner.rb', line 10

def initialize
  @frames = BRAILLE_FRAMES
  @index = 0
end

Instance Attribute Details

#frames ⇒ Object (readonly)

Returns the value of attribute frames.



8
9
10
# File 'lib/fun_ci/tui/spinner.rb', line 8

def frames
  @frames
end

Instance Method Details

#advance! ⇒ Object



19
20
21
# File 'lib/fun_ci/tui/spinner.rb', line 19

def advance!
  @index = (@index + 1) % @frames.length
end

#current_frame ⇒ Object



15
16
17
# File 'lib/fun_ci/tui/spinner.rb', line 15

def current_frame
  @frames[@index]
end