Sha256: cb4269349b4d3f02fda196e77ca3968d17c4ffffefc926a7b601efaec7ae8810

Contents?: true

Size: 561 Bytes

Versions: 15

Compression:

Stored size: 561 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

15 entries across 15 versions & 1 rubygems

Version Path
fasten-0.14.2 lib/fasten/support/ui.rb
fasten-0.14.0 lib/fasten/support/ui.rb
fasten-0.12.8 lib/fasten/support/ui.rb
fasten-0.12.6 lib/fasten/support/ui.rb
fasten-0.12.4 lib/fasten/support/ui.rb
fasten-0.12.2 lib/fasten/support/ui.rb
fasten-0.12.0 lib/fasten/support/ui.rb
fasten-0.10.0 lib/fasten/support/ui.rb
fasten-0.8.8 lib/fasten/support/ui.rb
fasten-0.8.6 lib/fasten/support/ui.rb
fasten-0.8.4 lib/fasten/support/ui.rb
fasten-0.8.0 lib/fasten/support/ui.rb
fasten-0.7.6 lib/fasten/support/ui.rb
fasten-0.7.4 lib/fasten/support/ui.rb
fasten-0.7.2 lib/fasten/support/ui.rb