Module: Parliament::Grom::Decorator::SeatIncumbency
- Defined in:
- lib/parliament/grom/decorator/seat_incumbency.rb
Overview
Decorator namespace for Grom::Node instances with type: id.ukpds.org/schema/SeatIncumbency
Instance Method Summary collapse
-
#constituency ⇒ Grom::Node?
Alias houseSeatHasConstituencyGroup with fallback.
-
#contact_points ⇒ Array
Alias incumbencyHasContactPoint with fallback.
-
#current? ⇒ Boolean
Checks if Grom::Node has no end date.
-
#end_date ⇒ DateTime?
Alias incumbencyEndDate with fallback.
-
#former? ⇒ Boolean
Checks if Grom::Node has an end date.
-
#house ⇒ Grom::Node?
Alias houseSeatHasHouse with fallback.
-
#member ⇒ Grom::Node?
Alias incumbencyHasMember with fallback.
-
#seat ⇒ Grom::Node?
Alias seatIncumbencyHasHouseSeat with fallback.
-
#start_date ⇒ DateTime?
Alias incumbencyStartDate with fallback.
Instance Method Details
#constituency ⇒ Grom::Node?
Alias houseSeatHasConstituencyGroup with fallback.
51 52 53 |
# File 'lib/parliament/grom/decorator/seat_incumbency.rb', line 51 def constituency seat.nil? ? nil : seat.constituency end |
#contact_points ⇒ Array
Alias incumbencyHasContactPoint with fallback.
58 59 60 |
# File 'lib/parliament/grom/decorator/seat_incumbency.rb', line 58 def contact_points respond_to?(:incumbencyHasContactPoint) ? incumbencyHasContactPoint : [] end |
#current? ⇒ Boolean
Checks if Grom::Node has no end date.
30 31 32 |
# File 'lib/parliament/grom/decorator/seat_incumbency.rb', line 30 def current? !former? end |
#end_date ⇒ DateTime?
Alias incumbencyEndDate with fallback.
16 17 18 |
# File 'lib/parliament/grom/decorator/seat_incumbency.rb', line 16 def end_date respond_to?(:incumbencyEndDate) ? DateTime.parse(incumbencyEndDate) : nil end |
#former? ⇒ Boolean
Checks if Grom::Node has an end date.
37 38 39 |
# File 'lib/parliament/grom/decorator/seat_incumbency.rb', line 37 def former? respond_to?(:incumbencyEndDate) end |
#house ⇒ Grom::Node?
Alias houseSeatHasHouse with fallback.
44 45 46 |
# File 'lib/parliament/grom/decorator/seat_incumbency.rb', line 44 def house seat.nil? ? nil : seat.house end |
#member ⇒ Grom::Node?
Alias incumbencyHasMember with fallback.
65 66 67 |
# File 'lib/parliament/grom/decorator/seat_incumbency.rb', line 65 def member respond_to?(:incumbencyHasMember) ? incumbencyHasMember.first : nil end |
#seat ⇒ Grom::Node?
Alias seatIncumbencyHasHouseSeat with fallback.
23 24 25 |
# File 'lib/parliament/grom/decorator/seat_incumbency.rb', line 23 def seat respond_to?(:seatIncumbencyHasHouseSeat) ? seatIncumbencyHasHouseSeat.first : nil end |
#start_date ⇒ DateTime?
Alias incumbencyStartDate with fallback.
9 10 11 |
# File 'lib/parliament/grom/decorator/seat_incumbency.rb', line 9 def start_date respond_to?(:incumbencyStartDate) ? DateTime.parse(incumbencyStartDate) : nil end |