module Gem::DefaultUserInteraction - Documentation for Ruby 4.0
Description: module Gem::DefaultUserInteraction: Module that defines the default UserInteraction. Any class including this module will have access to the +ui+ method that returns the default UI.
Keywords: ruby,module,Gem::DefaultUserInteraction

🔍

No recent searches

# module Gem::DefaultUserInteraction

Module that defines the default `UserInteraction`. Any class including this module will have access to the `ui` method that returns the default UI.

### Public Class Methods

ui ()
Source

    # File lib/rubygems/user_interaction.rb, line 27
    def self.ui
      @ui ||= Gem::ConsoleUI.new
    end

Return the default UI.

ui= (new_ui)
Source

    # File lib/rubygems/user_interaction.rb, line 35
    def self.ui=(new_ui)
      @ui = new_ui
    end

Set the default UI. If the default UI is never explicitly set, a simple console based `UserInteraction` will be used automatically.

use_ui (new_ui) { || ... }
Source

    # File lib/rubygems/user_interaction.rb, line 42
    def self.use_ui(new_ui)
      old_ui = @ui
      @ui = new_ui
      yield
    ensure
      @ui = old_ui
    end

Use `new_ui` for the duration of `block`.

### Public Instance Methods

ui ()
Source

    # File lib/rubygems/user_interaction.rb, line 53
    def ui
      Gem::DefaultUserInteraction.ui
    end

See `DefaultUserInteraction::ui`

ui= (new_ui)
Source

    # File lib/rubygems/user_interaction.rb, line 60
    def ui=(new_ui)
      Gem::DefaultUserInteraction.ui = new_ui
    end

See `DefaultUserInteraction::ui=`

use_ui (new_ui, &block)
Source

    # File lib/rubygems/user_interaction.rb, line 67
    def use_ui(new_ui, &block)
      Gem::DefaultUserInteraction.use_ui(new_ui, &block)
    end

See `DefaultUserInteraction::use_ui`