Module: Parliament::Grom::Decorator::SeatIncumbency
- Includes:
- Helpers::DateHelper
- 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.
Methods included from Helpers::DateHelper
Instance Method Details
#constituency ⇒ Grom::Node?
Alias houseSeatHasConstituencyGroup with fallback.
52 53 54 |
# File 'lib/parliament/grom/decorator/seat_incumbency.rb', line 52 def constituency seat.nil? ? nil : seat.constituency end |
#contact_points ⇒ Array
Alias incumbencyHasContactPoint with fallback.
59 60 61 |
# File 'lib/parliament/grom/decorator/seat_incumbency.rb', line 59 def contact_points respond_to?(:incumbencyHasContactPoint) ? incumbencyHasContactPoint : [] end |
#current? ⇒ Boolean
Checks if Grom::Node has no end date.
31 32 33 |
# File 'lib/parliament/grom/decorator/seat_incumbency.rb', line 31 def current? !former? end |
#end_date ⇒ DateTime?
Alias incumbencyEndDate with fallback.
17 18 19 |
# File 'lib/parliament/grom/decorator/seat_incumbency.rb', line 17 def end_date respond_to?(:incumbencyEndDate) ? DateTime.parse(incumbencyEndDate) : nil end |
#former? ⇒ Boolean
Checks if Grom::Node has an end date.
38 39 40 |
# File 'lib/parliament/grom/decorator/seat_incumbency.rb', line 38 def former? respond_to?(:incumbencyEndDate) end |
#house ⇒ Grom::Node?
Alias houseSeatHasHouse with fallback.
45 46 47 |
# File 'lib/parliament/grom/decorator/seat_incumbency.rb', line 45 def house seat.nil? ? nil : seat.house end |
#member ⇒ Grom::Node?
Alias incumbencyHasMember with fallback.
66 67 68 |
# File 'lib/parliament/grom/decorator/seat_incumbency.rb', line 66 def member respond_to?(:incumbencyHasMember) ? incumbencyHasMember.first : nil end |
#seat ⇒ Grom::Node?
Alias seatIncumbencyHasHouseSeat with fallback.
24 25 26 |
# File 'lib/parliament/grom/decorator/seat_incumbency.rb', line 24 def seat respond_to?(:seatIncumbencyHasHouseSeat) ? seatIncumbencyHasHouseSeat.first : nil end |
#start_date ⇒ DateTime?
Alias incumbencyStartDate with fallback.
10 11 12 |
# File 'lib/parliament/grom/decorator/seat_incumbency.rb', line 10 def start_date respond_to?(:incumbencyStartDate) ? DateTime.parse(incumbencyStartDate) : nil end |