lib/tty/prompt/slider.rb in tty-prompt-0.16.0 vs lib/tty/prompt/slider.rb in tty-prompt-0.16.1
- old
+ new
@@ -38,12 +38,10 @@
@active_color = options.fetch(:active_color) { @prompt.active_color }
@help_color = options.fetch(:help_color) { @prompt.help_color }
@format = options.fetch(:format) { FORMAT }
@first_render = true
@done = false
-
- @prompt.subscribe(self)
end
# Setup initial active position
#
# @return [Integer]
@@ -98,10 +96,12 @@
# @apu public
def call(question, &block)
@question = question
block.call(self) if block
@active = initial
- render
+ @prompt.subscribe(self) do
+ render
+ end
end
def keyleft(*)
@active -= 1 if @active > 0
end