Sha256: 6cd2c6846497a73dc88f644565f37de656f07a584bc6449176771da6933eff75

Contents?: true

Size: 559 Bytes

Versions: 1

Compression:

Stored size: 559 Bytes

Contents

require 'fasten/ui/console'

module Fasten
  module Support
    module UI
      def ui
        require 'fasten/ui/curses'

        @ui ||= if ui_mode.to_s == 'curses' && STDIN.tty? && STDOUT.tty?
                  Fasten::UI::Curses.new(runner: self)
                else
                  Fasten::UI::Console.new(runner: self)
                end
      rescue StandardError, LoadError
        @ui = Fasten::UI::Console.new(runner: self)
      end

      def run_ui
        ui.update

        yield
      ensure
        ui.cleanup
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
fasten-0.7.0 lib/fasten/support/ui.rb