Class: Pwl::Dialog::CocoaDialog

Inherits:
SystemDialog show all
Defined in:
lib/pwl/dialog/cocoa.rb

Direct Known Subclasses

CocoaPasswordDialog, CocoaTextDialog

Instance Attribute Summary

Attributes inherited from Base

#prompt, #title

Instance Method Summary collapse

Methods inherited from Base

#initialize

Constructor Details

This class inherits a constructor from Pwl::Dialog::Base

Instance Method Details

#get_inputObject

CocoaDialog returns two lines. The first line contains the number of the button, and the second line contains the actual user input. This method amends the base method with handling the two lines.



8
9
10
11
12
13
14
15
16
17
# File 'lib/pwl/dialog/cocoa.rb', line 8

def get_input
  result = super.lines.to_a
  result = [] if result.blank?

  case result.size
    when 1 then return_or_cancel(result[0], '')
    when 2 then return_or_cancel(result[0], result[1].chomp)
    else raise "Unknown response from running '#{command}'"
  end
end