Class: GovTrack::Person
Instance Method Summary collapse
- #current_role ⇒ Object
-
#initialize(attributes = {}) ⇒ Person
constructor
A new instance of Person.
- #roles ⇒ Object
Methods inherited from Base
#==, #eql?, find, find_by_id, find_by_uri, method_missing
Constructor Details
#initialize(attributes = {}) ⇒ Person
Returns a new instance of Person.
4 5 6 7 |
# File 'lib/govtrack/person.rb', line 4 def initialize(attributes={}) super @birthday = Date.parse(@birthday) if @birthday end |
Instance Method Details
#current_role ⇒ Object
9 10 11 |
# File 'lib/govtrack/person.rb', line 9 def current_role @current_role.class == GovTrack::Role ? @current_role : @current_role = GovTrack::Role.find_by_id(@current_role['id']) end |
#roles ⇒ Object
13 14 15 16 17 18 19 20 21 |
# File 'lib/govtrack/person.rb', line 13 def roles if @roles[0].class == GovTrack::Role @roles else @roles.map! { |role_uri| GovTrack::Role.find_by_uri(role_uri) } end end |