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.parliament.uk/schema/SeatIncumbency
Instance Method Summary collapse
-
#constituency ⇒ Grom::Node?
Alias houseSeatHasConstituencyGroup with fallback.
-
#contact_points ⇒ Array
Alias parliamentaryIncumbencyHasContactPoint with fallback.
-
#current? ⇒ Boolean
Checks if Grom::Node has no end date.
-
#end_date ⇒ DateTime?
Alias parliamentaryIncumbencyEndDate with fallback.
-
#former? ⇒ Boolean
Checks if Grom::Node has an end date.
-
#house ⇒ Grom::Node?
Alias houseSeatHasHouse with fallback.
-
#member ⇒ Grom::Node?
Alias parliamentaryIncumbencyHasMember with fallback.
-
#seat ⇒ Grom::Node?
Alias seatIncumbencyHasHouseSeat with fallback.
-
#start_date ⇒ DateTime?
Alias parliamentaryIncumbencyStartDate 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 parliamentaryIncumbencyHasContactPoint with fallback.
59 60 61 |
# File 'lib/parliament/grom/decorator/seat_incumbency.rb', line 59 def contact_points respond_to?(:parliamentaryIncumbencyHasContactPoint) ? parliamentaryIncumbencyHasContactPoint : [] 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 parliamentaryIncumbencyEndDate with fallback.
17 18 19 |
# File 'lib/parliament/grom/decorator/seat_incumbency.rb', line 17 def end_date respond_to?(:parliamentaryIncumbencyEndDate) ? DateTime.parse(parliamentaryIncumbencyEndDate) : 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?(:parliamentaryIncumbencyEndDate) 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 parliamentaryIncumbencyHasMember with fallback.
66 67 68 |
# File 'lib/parliament/grom/decorator/seat_incumbency.rb', line 66 def member respond_to?(:parliamentaryIncumbencyHasMember) ? parliamentaryIncumbencyHasMember.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 parliamentaryIncumbencyStartDate with fallback.
10 11 12 |
# File 'lib/parliament/grom/decorator/seat_incumbency.rb', line 10 def start_date respond_to?(:parliamentaryIncumbencyStartDate) ? DateTime.parse(parliamentaryIncumbencyStartDate) : nil end |