Class: NOMS::Command::Window
Defined Under Namespace
Instance Attribute Summary collapse
-
#console ⇒ Object
readonly
Returns the value of attribute console.
-
#document ⇒ Object
Returns the value of attribute document.
-
#location ⇒ Object
readonly
Returns the value of attribute location.
-
#name ⇒ Object
Returns the value of attribute name.
-
#origin ⇒ Object
Returns the value of attribute origin.
Attributes inherited from Base
Instance Method Summary collapse
- #alert(msg) ⇒ Object
-
#initialize(invoker = $0, origin = nil, opt = {}) ⇒ Window
constructor
A new instance of Window.
- #isatty ⇒ Object
- #prompt(prompt_text, echo = true) ⇒ Object
Methods inherited from Base
Constructor Details
#initialize(invoker = $0, origin = nil, opt = {}) ⇒ Window
Returns a new instance of Window.
22 23 24 25 26 27 28 29 |
# File 'lib/noms/command/window.rb', line 22 def initialize(invoker=$0, origin=nil, opt={}) @document = nil @origin = origin @name = invoker @log = opt[:logger] || default_logger @console = NOMS::Command::Window::Console.new(@log) @location = NOMS::Command::Window::Location.new(self) end |
Instance Attribute Details
#console ⇒ Object (readonly)
Returns the value of attribute console.
20 21 22 |
# File 'lib/noms/command/window.rb', line 20 def console @console end |
#document ⇒ Object
Returns the value of attribute document.
19 20 21 |
# File 'lib/noms/command/window.rb', line 19 def document @document end |
#location ⇒ Object (readonly)
Returns the value of attribute location.
20 21 22 |
# File 'lib/noms/command/window.rb', line 20 def location @location end |
#name ⇒ Object
Returns the value of attribute name.
19 20 21 |
# File 'lib/noms/command/window.rb', line 19 def name @name end |
#origin ⇒ Object
Returns the value of attribute origin.
19 20 21 |
# File 'lib/noms/command/window.rb', line 19 def origin @origin end |
Instance Method Details
#alert(msg) ⇒ Object
35 36 37 |
# File 'lib/noms/command/window.rb', line 35 def alert(msg) @log.error msg end |
#isatty ⇒ Object
31 32 33 |
# File 'lib/noms/command/window.rb', line 31 def isatty() $stdout.tty? end |
#prompt(prompt_text, echo = true) ⇒ Object
39 40 41 42 43 44 45 |
# File 'lib/noms/command/window.rb', line 39 def prompt(prompt_text, echo=true) echo = true if echo.nil? @log.debug "prompt(#{prompt_text.inspect}, #{echo.inspect})" v = ask(prompt_text) { |p| p.echo = false unless echo } @log.debug "-> #{v}" v end |