Class: Ppl::Command::Show
- Inherits:
-
Application::Command
- Object
- Application::Command
- Ppl::Command::Show
- Defined in:
- lib/ppl/command/show.rb
Instance Attribute Summary collapse
-
#format ⇒ Object
writeonly
Sets the attribute format.
Attributes inherited from Application::Command
Instance Method Summary collapse
- #execute(input, output) ⇒ Object
-
#initialize ⇒ Show
constructor
A new instance of Show.
- #options(parser, options) ⇒ Object
Methods inherited from Application::Command
Constructor Details
Instance Attribute Details
#format=(value) ⇒ Object (writeonly)
Sets the attribute format
6 7 8 |
# File 'lib/ppl/command/show.rb', line 6 def format=(value) @format = value end |
Instance Method Details
#execute(input, output) ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/ppl/command/show.rb', line 16 def execute(input, output) contact_id = input.arguments.shift if contact_id.nil? raise Ppl::Error::IncorrectUsage, "No contact specified" end contact = @storage.require_contact(contact_id) formatted = @format.process(contact) output.line(formatted) return true end |
#options(parser, options) ⇒ Object
12 13 14 |
# File 'lib/ppl/command/show.rb', line 12 def (parser, ) parser. = "usage: ppl show <contact>" end |