本文簡要介紹ruby語言中 Gem::UserInteraction模塊 的用法。
UserInteraction 允許RubyGems 通過標準方法與用戶交互,這些標準方法可以替換為針對不同顯示器的more-specific UI 方法。
由於 UserInteraction 分派到具體的 UI 類,您可能需要引用其他類以獲取特定行為,例如 Gem::ConsoleUI 或 Gem::SilentUI 。
例子:
class X
include Gem::UserInteraction
def get_answer
n = ask("What is the meaning of life?")
end
end
相關用法
- Ruby UndefinedConversionError.source_encoding用法及代碼示例
- Ruby UnboundMethod.original_name用法及代碼示例
- Ruby URI.parse用法及代碼示例
- Ruby UID.change_privilege用法及代碼示例
- Ruby Util.unescape用法及代碼示例
- Ruby Util.url_encode用法及代碼示例
- Ruby UNIXSocket.new用法及代碼示例
- Ruby UNIXSocket.addr用法及代碼示例
- Ruby UnboundMethod.bind用法及代碼示例
- Ruby URI模塊用法及代碼示例
- Ruby UNIXServer.accept用法及代碼示例
- Ruby UNIXSocket.recv_io用法及代碼示例
- Ruby UID.euid用法及代碼示例
- Ruby UncaughtThrowError類用法及代碼示例
- Ruby Util.pretty用法及代碼示例
- Ruby UID.uid用法及代碼示例
- Ruby UnwindDetails.all_requirements用法及代碼示例
- Ruby UnboundMethod類用法及代碼示例
- Ruby UnwindDetails.reversed_requirement_tree_index用法及代碼示例
- Ruby UnboundMethod.parameters用法及代碼示例
- Ruby Util.rfc1123_date用法及代碼示例
- Ruby URI.join用法及代碼示例
- Ruby UNIXServer.new用法及代碼示例
- Ruby URI.decode_www_form用法及代碼示例
- Ruby UDPSocket.new用法及代碼示例
注:本文由純淨天空篩選整理自ruby-lang.org大神的英文原創作品 UserInteraction模塊。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。
