Sha256: 229fb1705c3a8d04a9fd74a363a9d03271c567c5ff9a4d98e6c9ba5efab976b1
Contents?: true
Size: 988 Bytes
Versions: 4
Compression:
Stored size: 988 Bytes
Contents
class Ppl::Command::Age < Ppl::Application::Command name "age" description "List or show contacts's ages" attr_writer :list_format attr_writer :show_format def initialize @list_format = Ppl::Format::AddressBook::Ages.new @show_format = Ppl::Format::Contact::Age.new end def options(parser, options) parser.banner = "usage: ppl age" end def execute(input, output) action = determine_action(input) send(action, input, output) end private def determine_action(input) if input.arguments[0].nil? :list_ages else :show_age end end def list_ages(input, output) address_book = @storage.load_address_book formatted = @list_format.process(address_book) output.line(formatted) return true end def show_age(input, output) contact = @storage.require_contact(input.arguments.first) formatted = @show_format.process(contact) output.line(formatted) return true end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
ppl-1.14.1 | lib/ppl/command/age.rb |
ppl-1.14.0 | lib/ppl/command/age.rb |
ppl-1.13.0 | lib/ppl/command/age.rb |
ppl-1.12.0 | lib/ppl/command/age.rb |