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
Constructor Details
Instance Attribute Details
#format=(value) ⇒ Object (writeonly)
Sets the attribute format
4 5 6 |
# File 'lib/ppl/command/show.rb', line 4 def format=(value) @format = value end |
Instance Method Details
#execute(input, output) ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/ppl/command/show.rb', line 17 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
13 14 15 |
# File 'lib/ppl/command/show.rb', line 13 def (parser, ) parser. = "usage: ppl show <contact>" end |