Class: Ppl::Command::Email

Inherits:
Application::Command show all
Defined in:
lib/ppl/command/email.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

#custom_format=(value) ⇒ Object (writeonly)

Sets the attribute custom_format

Parameters:

  • value

    the value to set the attribute custom_format to.



9
10
11
# File 'lib/ppl/command/email.rb', line 9

def custom_format=(value)
  @custom_format = value
end

#email_service=(value) ⇒ Object (writeonly)

Sets the attribute email_service

Parameters:

  • value

    the value to set the attribute email_service to.



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

def email_service=(value)
  @email_service = value
end

#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/email.rb', line 7

def list_format=(value)
  @list_format = 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/email.rb', line 8

def show_format=(value)
  @show_format = value
end

Instance Method Details

#execute(input, output) ⇒ Object



27
28
29
30
31
# File 'lib/ppl/command/email.rb', line 27

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

#options(parser, options) ⇒ Object



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

def options(parser, options)
  parser.banner = "usage: ppl email <contact> [<email-address>]"
  parser.on("-d", "--delete", "delete email address") do
    options[:delete] = true
  end
  parser.on("-p", "--preferred", "mark address as preferred") do
    options[:preferred] = true
  end
  parser.on("-P", "--not-preferred", "mark address as not preferred") do
    options[:preferred] = false
  end
  parser.on("--format <format>", "specify a custom output format") do |f|
    options[:format] = f
  end
end