123456789_123456789_123456789_123456789_123456789_

Module: Gem::DefaultUserInteraction

Overview

When rubygems/test_case is required the default user interaction is a MockGemUi.

Class Attribute Summary

Class Method Summary

Instance Attribute Summary

Instance Method Summary

Class Attribute Details

.ui (rw)

Return the default UI.

[ GitHub ]

  
# File 'lib/rubygems/user_interaction.rb', line 27

def self.ui
  @ui ||= Gem::ConsoleUI.new
end

.ui=(new_ui) (rw)

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

[ GitHub ]

  
# File 'lib/rubygems/user_interaction.rb', line 35

def self.ui=(new_ui)
  @ui = new_ui
end

Class Method Details

.use_ui(new_ui)

Use new_ui for the duration of block.

[ GitHub ]

  
# 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

Instance Attribute Details

#ui (rw)

See .ui

[ GitHub ]

  
# File 'lib/rubygems/user_interaction.rb', line 53

def ui
  Gem::DefaultUserInteraction.ui
end

#ui=(new_ui) (rw)

See .ui=

[ GitHub ]

  
# File 'lib/rubygems/user_interaction.rb', line 60

def ui=(new_ui)
  Gem::DefaultUserInteraction.ui = new_ui
end

Instance Method Details

#use_ui(new_ui, &block)

See .use_ui

[ GitHub ]

  
# File 'lib/rubygems/user_interaction.rb', line 67

def use_ui(new_ui, &block)
  Gem::DefaultUserInteraction.use_ui(new_ui, &block)
end