Class: Governator::Governor
- Inherits:
-
Object
- Object
- Governator::Governor
- Defined in:
- lib/governator/governor.rb
Overview
Instance methods included in the Governator class
Instance Attribute Summary collapse
-
#office_locations ⇒ Object
readonly
Returns the value of attribute office_locations.
-
#official_full ⇒ Object
readonly
Returns the value of attribute official_full.
-
#parsed_name ⇒ Object
readonly
Returns the value of attribute parsed_name.
-
#party ⇒ Object
readonly
Returns the value of attribute party.
-
#state_name ⇒ Object
readonly
Returns the value of attribute state_name.
-
#twitter ⇒ Object
readonly
Returns the value of attribute twitter.
-
#url ⇒ Object
readonly
Returns the value of attribute url.
Class Method Summary collapse
Instance Method Summary collapse
- #contact_form ⇒ Object
- #facebook ⇒ Object
- #first_name ⇒ Object
-
#initialize(panel) ⇒ Governor
constructor
Initializes a new Governator instance.
- #inspect ⇒ Object
- #last_name ⇒ Object
- #middle_name ⇒ Object
- #nickname ⇒ Object
- #photo_url ⇒ Object
- #primary_office ⇒ Object
- #secondary_office ⇒ Object
- #suffix ⇒ Object
- #to_h ⇒ Object
Constructor Details
#initialize(panel) ⇒ Governor
Initializes a new Governator instance
21 22 23 |
# File 'lib/governator/governor.rb', line 21 def initialize(panel) @panel = panel end |
Instance Attribute Details
#office_locations ⇒ Object (readonly)
Returns the value of attribute office_locations.
6 7 8 |
# File 'lib/governator/governor.rb', line 6 def office_locations @office_locations end |
#official_full ⇒ Object (readonly)
Returns the value of attribute official_full.
6 7 8 |
# File 'lib/governator/governor.rb', line 6 def official_full @official_full end |
#parsed_name ⇒ Object (readonly)
Returns the value of attribute parsed_name.
6 7 8 |
# File 'lib/governator/governor.rb', line 6 def parsed_name @parsed_name end |
#party ⇒ Object (readonly)
Returns the value of attribute party.
6 7 8 |
# File 'lib/governator/governor.rb', line 6 def party @party end |
#state_name ⇒ Object (readonly)
Returns the value of attribute state_name.
6 7 8 |
# File 'lib/governator/governor.rb', line 6 def state_name @state_name end |
#twitter ⇒ Object (readonly)
Returns the value of attribute twitter.
6 7 8 |
# File 'lib/governator/governor.rb', line 6 def twitter @twitter end |
#url ⇒ Object (readonly)
Returns the value of attribute url.
6 7 8 |
# File 'lib/governator/governor.rb', line 6 def url @url end |
Class Method Details
.create(panel) ⇒ Object
11 12 13 14 15 16 |
# File 'lib/governator/governor.rb', line 11 def self.create(panel) new(panel).tap do |g| g.send :build g.send :save end end |
Instance Method Details
#contact_form ⇒ Object
52 53 54 |
# File 'lib/governator/governor.rb', line 52 def contact_form civil_services.contact_form end |
#facebook ⇒ Object
48 49 50 |
# File 'lib/governator/governor.rb', line 48 def facebook civil_services.facebook end |
#first_name ⇒ Object
56 57 58 |
# File 'lib/governator/governor.rb', line 56 def first_name parsed_name.first_name end |
#inspect ⇒ Object
32 33 34 |
# File 'lib/governator/governor.rb', line 32 def inspect "#<Governator #{official_full}>" end |
#last_name ⇒ Object
68 69 70 |
# File 'lib/governator/governor.rb', line 68 def last_name parsed_name.last_name end |
#middle_name ⇒ Object
60 61 62 |
# File 'lib/governator/governor.rb', line 60 def middle_name parsed_name.middle_name end |
#nickname ⇒ Object
64 65 66 |
# File 'lib/governator/governor.rb', line 64 def nickname parsed_name.nickname end |
#photo_url ⇒ Object
44 45 46 |
# File 'lib/governator/governor.rb', line 44 def photo_url civil_services.photo_url || Governator::BASE_URI + panel.image end |
#primary_office ⇒ Object
40 41 42 |
# File 'lib/governator/governor.rb', line 40 def primary_office @_primary_office ||= office end |
#secondary_office ⇒ Object
36 37 38 |
# File 'lib/governator/governor.rb', line 36 def secondary_office @_secondary_office ||= office(prefix: :alt_) end |
#suffix ⇒ Object
72 73 74 |
# File 'lib/governator/governor.rb', line 72 def suffix parsed_name.suffix end |
#to_h ⇒ Object
25 26 27 28 29 30 |
# File 'lib/governator/governor.rb', line 25 def to_h syms = %i[photo_url state_name official_full url party office_locations] syms.each_with_object({}) do |sym, hsh| hsh[sym] = send(sym) end end |