Class: Bcome::Interactive::Session
Instance Attribute Summary collapse
-
#irb_session ⇒ Object
readonly
Returns the value of attribute irb_session.
-
#responses ⇒ Object
readonly
Returns the value of attribute responses.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(irb_session) ⇒ Session
constructor
A new instance of Session.
- #process_item(item) ⇒ Object
- #prompt ⇒ Object
Constructor Details
#initialize(irb_session) ⇒ Session
Returns a new instance of Session.
22 23 24 25 |
# File 'lib/interactive/session.rb', line 22 def initialize(irb_session) @irb_session = irb_session @responses = {} end |
Instance Attribute Details
#irb_session ⇒ Object (readonly)
Returns the value of attribute irb_session.
20 21 22 |
# File 'lib/interactive/session.rb', line 20 def irb_session @irb_session end |
#responses ⇒ Object (readonly)
Returns the value of attribute responses.
20 21 22 |
# File 'lib/interactive/session.rb', line 20 def responses @responses end |
Class Method Details
.run(irb_session) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/interactive/session.rb', line 5 def run(irb_session) irb_pre_session_return_format = irb_session.conf.return_format = "\ninteractive session ended".success begin session = ::Bcome::Interactive::Session.new(irb_session) irb_session.conf.return_format = "" system("clear") session.prompt rescue ::Bcome::Interactive::SessionHalt irb_session.conf.return_format = irb_pre_session_return_format puts end end |
Instance Method Details
#process_item(item) ⇒ Object
33 34 35 36 37 38 39 |
# File 'lib/interactive/session.rb', line 33 def process_item(item) begin item.do rescue raise ::Bcome::Interactive::SessionHalt.new end end |
#prompt ⇒ Object
27 28 29 30 31 |
# File 'lib/interactive/session.rb', line 27 def prompt item = ::Bcome::Interactive::SessionItem::TransparentSsh.new(self) print item. process_item(item) end |