Class: Ppl::Command::Post
- Inherits:
-
Application::Command
- Object
- Application::Command
- Ppl::Command::Post
- Defined in:
- lib/ppl/command/post.rb
Instance Attribute Summary collapse
-
#address_book_format ⇒ Object
writeonly
Sets the attribute address_book_format.
-
#address_service ⇒ Object
writeonly
Sets the attribute address_service.
-
#contact_format ⇒ Object
writeonly
Sets the attribute contact_format.
-
#postal_address_format ⇒ Object
writeonly
Sets the attribute postal_address_format.
Attributes inherited from Application::Command
Instance Method Summary collapse
Methods inherited from Application::Command
Instance Attribute Details
#address_book_format=(value) ⇒ Object (writeonly)
Sets the attribute address_book_format
8 9 10 |
# File 'lib/ppl/command/post.rb', line 8 def address_book_format=(value) @address_book_format = value end |
#address_service=(value) ⇒ Object (writeonly)
Sets the attribute address_service
6 7 8 |
# File 'lib/ppl/command/post.rb', line 6 def address_service=(value) @address_service = value end |
#contact_format=(value) ⇒ Object (writeonly)
Sets the attribute contact_format
7 8 9 |
# File 'lib/ppl/command/post.rb', line 7 def contact_format=(value) @contact_format = value end |
#postal_address_format=(value) ⇒ Object (writeonly)
Sets the attribute postal_address_format
9 10 11 |
# File 'lib/ppl/command/post.rb', line 9 def postal_address_format=(value) @postal_address_format = value end |
Instance Method Details
#execute(input, output) ⇒ Object
49 50 51 52 |
# File 'lib/ppl/command/post.rb', line 49 def execute(input, output) action = determine_action(input) send(action, input, output) end |
#options(parser, options) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/ppl/command/post.rb', line 11 def (parser, ) parser. = "usage: ppl post <contact> [address]" parser.on("-s", "--street <street-address>") do |street| [:street] = street end parser.on("-z", "--postal-code <postal-code>") do |postal_code| [:postal_code] = postal_code end parser.on("-p", "--po-box <po-box>") do |po_box| [:po_box] = po_box end parser.on("-l", "--locality <locality>") do |locality| [:locality] = locality end parser.on("-r", "--region <region>") do |region| [:region] = region end parser.on("-c", "--country <country>") do |country| [:country] = country end parser.on("-d", "--delete") do [:delete] = true end parser.on("-m", "--move <new-id>") do |new_id| [:new_id] = new_id end parser.on("-p", "--preferred", "mark address as preferred") do [:preferred] = true end parser.on("-P", "--not-preferred", "mark address as not preferred") do [:preferred] = false end end |