Class: PollTracker::Poll
- Inherits:
-
Object
- Object
- PollTracker::Poll
- Defined in:
- lib/poll_tracker/poll.rb
Instance Attribute Summary collapse
-
#clinton ⇒ Object
Returns the value of attribute clinton.
-
#date ⇒ Object
Returns the value of attribute date.
-
#lead ⇒ Object
Returns the value of attribute lead.
-
#name ⇒ Object
Returns the value of attribute name.
-
#polled ⇒ Object
Returns the value of attribute polled.
-
#trump ⇒ Object
Returns the value of attribute trump.
Class Method Summary collapse
Instance Method Summary collapse
- #clinton_results(input) ⇒ Object
- #dates(input) ⇒ Object
-
#initialize ⇒ Poll
constructor
A new instance of Poll.
- #leads(input) ⇒ Object
- #names(input) ⇒ Object
- #number_polled(input) ⇒ Object
- #trump_results(input) ⇒ Object
Constructor Details
#initialize ⇒ Poll
Returns a new instance of Poll.
6 7 8 9 10 11 12 13 |
# File 'lib/poll_tracker/poll.rb', line 6 def initialize @name = name @date = date @polled = polled @lead = lead @clinton = clinton @trump = trump end |
Instance Attribute Details
#clinton ⇒ Object
Returns the value of attribute clinton.
4 5 6 |
# File 'lib/poll_tracker/poll.rb', line 4 def clinton @clinton end |
#date ⇒ Object
Returns the value of attribute date.
4 5 6 |
# File 'lib/poll_tracker/poll.rb', line 4 def date @date end |
#lead ⇒ Object
Returns the value of attribute lead.
4 5 6 |
# File 'lib/poll_tracker/poll.rb', line 4 def lead @lead end |
#name ⇒ Object
Returns the value of attribute name.
4 5 6 |
# File 'lib/poll_tracker/poll.rb', line 4 def name @name end |
#polled ⇒ Object
Returns the value of attribute polled.
4 5 6 |
# File 'lib/poll_tracker/poll.rb', line 4 def polled @polled end |
#trump ⇒ Object
Returns the value of attribute trump.
4 5 6 |
# File 'lib/poll_tracker/poll.rb', line 4 def trump @trump end |
Class Method Details
.new_poll(input) ⇒ Object
39 40 41 42 43 44 45 46 47 48 |
# File 'lib/poll_tracker/poll.rb', line 39 def self.new_poll(input) @poll = self.new @poll.name = @poll.names(input) @poll.clinton = @poll.clinton_results(input) @poll.trump = @poll.trump_results(input) @poll.lead = @poll.leads(input) @poll.date = @poll.dates(input) @poll.polled = @poll.number_polled(input) @poll end |
Instance Method Details
#clinton_results(input) ⇒ Object
19 20 21 |
# File 'lib/poll_tracker/poll.rb', line 19 def clinton_results(input) PollTracker::Scraper.clinton_results[input.to_i] end |
#dates(input) ⇒ Object
31 32 33 |
# File 'lib/poll_tracker/poll.rb', line 31 def dates(input) PollTracker::Scraper.scrape_poll_date[input.to_i] end |
#leads(input) ⇒ Object
27 28 29 |
# File 'lib/poll_tracker/poll.rb', line 27 def leads(input) PollTracker::Scraper.scrape_result_spread[input.to_i] end |
#names(input) ⇒ Object
15 16 17 |
# File 'lib/poll_tracker/poll.rb', line 15 def names(input) PollTracker::Scraper.scrape_poll_names[input.to_i] end |
#number_polled(input) ⇒ Object
35 36 37 |
# File 'lib/poll_tracker/poll.rb', line 35 def number_polled(input) PollTracker::Scraper.scrape_likely_voters[input.to_i] end |
#trump_results(input) ⇒ Object
23 24 25 |
# File 'lib/poll_tracker/poll.rb', line 23 def trump_results(input) PollTracker::Scraper.trump_results[input.to_i] end |