Class: Ppl::Command::Phone

Inherits:
Application::Command show all
Defined in:
lib/ppl/command/phone.rb

Instance Attribute Summary collapse

Attributes inherited from Application::Command

#storage

Instance Method Summary collapse

Methods inherited from Application::Command

add_property

Instance Attribute Details

#list_format=(value) ⇒ Object (writeonly)

Sets the attribute list_format

Parameters:

  • value

    the value to set the attribute list_format to.



7
8
9
# File 'lib/ppl/command/phone.rb', line 7

def list_format=(value)
  @list_format = value
end

#phone_service=(value) ⇒ Object (writeonly)

Sets the attribute phone_service

Parameters:

  • value

    the value to set the attribute phone_service to.



6
7
8
# File 'lib/ppl/command/phone.rb', line 6

def phone_service=(value)
  @phone_service = value
end

#show_format=(value) ⇒ Object (writeonly)

Sets the attribute show_format

Parameters:

  • value

    the value to set the attribute show_format to.



8
9
10
# File 'lib/ppl/command/phone.rb', line 8

def show_format=(value)
  @show_format = value
end

Instance Method Details

#execute(input, output) ⇒ Object



26
27
28
29
30
# File 'lib/ppl/command/phone.rb', line 26

def execute(input, output)
  action = determine_action(input)
  send(action, input, output)
  true
end

#options(parser, options) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/ppl/command/phone.rb', line 10

def options(parser, options)
  parser.banner = "usage: ppl phone <contact> [<number>]"
  parser.on("-d", "--delete", "delete phone number") do
    options[:delete] = true
  end
  parser.on("-t", "--type <type>", "set the phone number's type") do |type|
    options[:type] = type
  end
  parser.on("-p", "--preferred", "mark phone number as preferred") do
    options[:preferred] = true
  end
  parser.on("-P", "--not-preferred", "mark phone number as not preferred") do
    options[:preferred] = false
  end
end