Class: Ppl::Command::Phone
- Inherits:
-
Application::Command
- Object
- Application::Command
- Ppl::Command::Phone
- Defined in:
- lib/ppl/command/phone.rb
Instance Attribute Summary collapse
-
#list_format ⇒ Object
writeonly
Sets the attribute list_format.
-
#phone_service ⇒ Object
writeonly
Sets the attribute phone_service.
-
#show_format ⇒ Object
writeonly
Sets the attribute show_format.
Attributes inherited from Application::Command
Instance Method Summary collapse
Methods inherited from Application::Command
Instance Attribute Details
#list_format=(value) ⇒ Object (writeonly)
Sets the attribute list_format
7 8 9 |
# File 'lib/ppl/command/phone.rb', line 7 def list_format=(value) @list_format = value end |
#phone_service=(value) ⇒ Object (writeonly)
Sets the attribute phone_service
6 7 8 |
# File 'lib/ppl/command/phone.rb', line 6 def phone_service=(value) @phone_service = value end |
#show_format=(value) ⇒ Object (writeonly)
Sets the attribute show_format
8 9 10 |
# File 'lib/ppl/command/phone.rb', line 8 def show_format=(value) @show_format = value end |
Instance Method Details
#execute(input, output) ⇒ Object
26 27 28 29 30 |
# File 'lib/ppl/command/phone.rb', line 26 def execute(input, output) action = determine_action(input) send(action, input, output) true end |
#options(parser, options) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/ppl/command/phone.rb', line 10 def (parser, ) parser. = "usage: ppl phone <contact> [<number>]" parser.on("-d", "--delete", "delete phone number") do [:delete] = true end parser.on("-t", "--type <type>", "set the phone number's type") do |type| [:type] = type end parser.on("-p", "--preferred", "mark phone number as preferred") do [:preferred] = true end parser.on("-P", "--not-preferred", "mark phone number as not preferred") do [:preferred] = false end end |