class Ppl::Command::Age
Attributes
list_format[W]
show_format[W]
Public Instance Methods
execute(input, output)
click to toggle source
# File lib/ppl/command/age.rb, line 13 def execute(input, output) action = determine_action(input) send(action, input, output) end
options(parser, options)
click to toggle source
# File lib/ppl/command/age.rb, line 9 def options(parser, options) parser.banner = "usage: ppl age" end
Private Instance Methods
determine_action(input)
click to toggle source
# File lib/ppl/command/age.rb, line 21 def determine_action(input) if input.arguments[0].nil? :list_ages else :show_age end end
list_ages(input, output)
click to toggle source
# File lib/ppl/command/age.rb, line 29 def list_ages(input, output) address_book = @storage.load_address_book formatted = @list_format.process(address_book) output.line(formatted) return true end
show_age(input, output)
click to toggle source
# File lib/ppl/command/age.rb, line 36 def show_age(input, output) contact = @storage.require_contact(input.arguments.first) formatted = @show_format.process(contact) output.line(formatted) return true end