Class: AfterNotifier::OptionParser
- Inherits:
-
Object
- Object
- AfterNotifier::OptionParser
- Defined in:
- lib/after_notifier/option_parser.rb
Instance Attribute Summary collapse
-
#pid ⇒ Object
readonly
Returns the value of attribute pid.
-
#terminal_notifier_options ⇒ Object
readonly
Returns the value of attribute terminal_notifier_options.
Instance Method Summary collapse
-
#initialize(argv) ⇒ OptionParser
constructor
A new instance of OptionParser.
- #valid_pid? ⇒ Boolean
Constructor Details
#initialize(argv) ⇒ OptionParser
Returns a new instance of OptionParser.
9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/after_notifier/option_parser.rb', line 9 def initialize(argv) @pid = argv.shift = argv raise OptionParseError, 'Required PID' unless valid_pid? # When unset -message option, set default message. unless .include?("-message") .push(*["-message", "AFTER_NOTIFIER"]) end end |
Instance Attribute Details
#pid ⇒ Object (readonly)
Returns the value of attribute pid.
7 8 9 |
# File 'lib/after_notifier/option_parser.rb', line 7 def pid @pid end |
#terminal_notifier_options ⇒ Object (readonly)
Returns the value of attribute terminal_notifier_options.
7 8 9 |
# File 'lib/after_notifier/option_parser.rb', line 7 def end |
Instance Method Details
#valid_pid? ⇒ Boolean
21 22 23 24 |
# File 'lib/after_notifier/option_parser.rb', line 21 def valid_pid? # PID is number above 0. @pid.to_i > 0 end |