Class: Ironment::CL::Prompter
- Inherits:
-
Object
- Object
- Ironment::CL::Prompter
- Defined in:
- lib/ironment/cl/prompter.rb
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ Prompter
constructor
A new instance of Prompter.
- #modified(runcom) ⇒ Object
- #not_trusted(runcom) ⇒ Object
- #request_user_action(runcom) ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ Prompter
Returns a new instance of Prompter.
4 5 6 7 8 |
# File 'lib/ironment/cl/prompter.rb', line 4 def initialize( = {}) @in = [:in] || $stdin @out = [:out] || $stdout @truster = [:truster] || Truster.new end |
Instance Method Details
#modified(runcom) ⇒ Object
15 16 17 18 |
# File 'lib/ironment/cl/prompter.rb', line 15 def modified(runcom) prompt_modified(runcom) request_user_action(runcom) end |
#not_trusted(runcom) ⇒ Object
10 11 12 13 |
# File 'lib/ironment/cl/prompter.rb', line 10 def not_trusted(runcom) prompt_not_trusted(runcom) request_user_action(runcom) end |
#request_user_action(runcom) ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/ironment/cl/prompter.rb', line 20 def request_user_action(runcom) prompt_question case @in.gets.strip.to_sym when :y @truster.trust(runcom) true when :v prompt_content(runcom) request_user_action(runcom) when :n false else request_user_action(runcom) end end |