Module
Module
that defines the default UserInteraction
. Any class including this module will have access to the ui
method that returns the default UI.
Class Methods
::
lib/rubygems/user_interaction.rb
View on GitHub
# File tmp/rubies/ruby-3.3.0/lib/rubygems/user_interaction.rb, line 28
def self.ui
@ui ||= Gem::ConsoleUI.new
end
Return the default UI.
::
lib/rubygems/user_interaction.rb
View on GitHub
# File tmp/rubies/ruby-3.3.0/lib/rubygems/user_interaction.rb, line 36
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.
lib/rubygems/user_interaction.rb
View on GitHub
# File tmp/rubies/ruby-3.3.0/lib/rubygems/user_interaction.rb, line 43
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
.
Instance Methods
#
lib/rubygems/user_interaction.rb
View on GitHub
# File tmp/rubies/ruby-3.3.0/lib/rubygems/user_interaction.rb, line 54
def ui
Gem::DefaultUserInteraction.ui
end
lib/rubygems/user_interaction.rb
View on GitHub
# File tmp/rubies/ruby-3.3.0/lib/rubygems/user_interaction.rb, line 61
def ui=(new_ui)
Gem::DefaultUserInteraction.ui = new_ui
end
lib/rubygems/user_interaction.rb
View on GitHub
# File tmp/rubies/ruby-3.3.0/lib/rubygems/user_interaction.rb, line 68
def use_ui(new_ui, &block)
Gem::DefaultUserInteraction.use_ui(new_ui, &block)
end