Class: Fatty::Terminal::PopupOwner
- Inherits:
-
Object
- Object
- Fatty::Terminal::PopupOwner
- Defined in:
- lib/fatty/terminal/popup_owner.rb
Instance Attribute Summary collapse
-
#on_cancel ⇒ Object
readonly
Returns the value of attribute on_cancel.
-
#on_result ⇒ Object
readonly
Returns the value of attribute on_result.
Instance Method Summary collapse
-
#initialize(on_result: nil, on_cancel: nil) ⇒ PopupOwner
constructor
A new instance of PopupOwner.
- #update(msg) ⇒ Object
Constructor Details
#initialize(on_result: nil, on_cancel: nil) ⇒ PopupOwner
Returns a new instance of PopupOwner.
8 9 10 11 |
# File 'lib/fatty/terminal/popup_owner.rb', line 8 def initialize(on_result: nil, on_cancel: nil) @on_result = on_result @on_cancel = on_cancel end |
Instance Attribute Details
#on_cancel ⇒ Object (readonly)
Returns the value of attribute on_cancel.
6 7 8 |
# File 'lib/fatty/terminal/popup_owner.rb', line 6 def on_cancel @on_cancel end |
#on_result ⇒ Object (readonly)
Returns the value of attribute on_result.
6 7 8 |
# File 'lib/fatty/terminal/popup_owner.rb', line 6 def on_result @on_result end |
Instance Method Details
#update(msg) ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/fatty/terminal/popup_owner.rb', line 13 def update(msg) _cmd, name, payload = msg case name when :popup_result, :prompt_result on_result&.call(payload) when :popup_cancelled, :prompt_cancelled on_cancel&.call end [] end |