Class: ApprovalRatings::Rating
- Inherits:
-
Object
- Object
- ApprovalRatings::Rating
- Defined in:
- lib/approval_ratings/rating.rb
Overview
OpenSSL::SSL::VERIFY_PEER = OpenSSL::SSL::VERIFY_NONE
Instance Attribute Summary collapse
-
#approval ⇒ Object
Returns the value of attribute approval.
-
#date ⇒ Object
Returns the value of attribute date.
-
#disapproval ⇒ Object
Returns the value of attribute disapproval.
-
#name ⇒ Object
Returns the value of attribute name.
-
#summary ⇒ Object
Returns the value of attribute summary.
-
#url ⇒ Object
Returns the value of attribute url.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(name = nil, date = nil, summary = nil, approval = nil, disapproval = nil) ⇒ Rating
constructor
A new instance of Rating.
Constructor Details
#initialize(name = nil, date = nil, summary = nil, approval = nil, disapproval = nil) ⇒ Rating
Returns a new instance of Rating.
9 10 11 12 13 14 15 16 |
# File 'lib/approval_ratings/rating.rb', line 9 def initialize(name = nil, date = nil, summary = nil, approval = nil, disapproval = nil) @name = name @date = date @summary = summary @approval = approval @disapproval = disapproval @url = 'https://projects.fivethirtyeight.com/trump-approval-ratings/' end |
Instance Attribute Details
#approval ⇒ Object
Returns the value of attribute approval.
7 8 9 |
# File 'lib/approval_ratings/rating.rb', line 7 def approval @approval end |
#date ⇒ Object
Returns the value of attribute date.
7 8 9 |
# File 'lib/approval_ratings/rating.rb', line 7 def date @date end |
#disapproval ⇒ Object
Returns the value of attribute disapproval.
7 8 9 |
# File 'lib/approval_ratings/rating.rb', line 7 def disapproval @disapproval end |
#name ⇒ Object
Returns the value of attribute name.
7 8 9 |
# File 'lib/approval_ratings/rating.rb', line 7 def name @name end |
#summary ⇒ Object
Returns the value of attribute summary.
7 8 9 |
# File 'lib/approval_ratings/rating.rb', line 7 def summary @summary end |
#url ⇒ Object
Returns the value of attribute url.
7 8 9 |
# File 'lib/approval_ratings/rating.rb', line 7 def url @url end |
Class Method Details
.all ⇒ Object
18 19 20 |
# File 'lib/approval_ratings/rating.rb', line 18 def self.all @@all ||= end |
.find(id) ⇒ Object
22 23 24 |
# File 'lib/approval_ratings/rating.rb', line 22 def self.find(id) self.all[id-1] end |
.find_by_name(name) ⇒ Object
26 27 28 |
# File 'lib/approval_ratings/rating.rb', line 26 def self.find_by_name(name) self.all.find_all { |i| i.name.downcase.strip == name.downcase.strip } end |