Class: Ppl::Command::Scrape
- Inherits:
-
Application::Command
- Object
- Application::Command
- Ppl::Command::Scrape
- Defined in:
- lib/ppl/command/scrape.rb
Instance Attribute Summary collapse
-
#email_scraper ⇒ Object
writeonly
Sets the attribute email_scraper.
Attributes inherited from Application::Command
Instance Method Summary collapse
Methods inherited from Application::Command
Instance Attribute Details
#email_scraper=(value) ⇒ Object (writeonly)
Sets the attribute email_scraper
8 9 10 |
# File 'lib/ppl/command/scrape.rb', line 8 def email_scraper=(value) @email_scraper = value end |
Instance Method Details
#execute(input, output) ⇒ Object
20 21 22 23 24 25 26 27 28 |
# File 'lib/ppl/command/scrape.rb', line 20 def execute(input, output) contacts = scrape_email(input) contacts.each do |contact| if store_contact?(contact, input) @storage.save_contact(contact) end end return true end |
#options(parser, options) ⇒ Object
10 11 12 13 14 15 16 17 18 |
# File 'lib/ppl/command/scrape.rb', line 10 def (parser, ) parser. = "usage: ppl scrape [<options>]" parser.on("-q", "--quiet", "Add contacts to the address book without prompting") do |i| [:quiet] = i end parser.on("-s", "--sender", "Scrape the sender's contact details") do |i| [:sender] = i end end |