Module: Parliament::Grom::Decorator::GovernmentIncumbency
- Includes:
- Helpers::DateHelper
- Defined in:
- lib/parliament/grom/decorator/government_incumbency.rb
Overview
Decorator namespace for Grom::Node instances with type: id.parliament.uk/schema/governmentIncumbency.
Instance Method Summary collapse
-
#current? ⇒ Boolean
Checks if Grom::Node has an end date.
-
#end_date ⇒ DateTime?
Alias incumbencyEndDate with fallback.
-
#government_position ⇒ Grom::Node?
Alias governmentIncumbencyHasGovernmentPosition with fallback.
-
#start_date ⇒ DateTime?
Alias incumbencyStartDate with fallback.
Methods included from Helpers::DateHelper
Instance Method Details
#current? ⇒ Boolean
Checks if Grom::Node has an end date.
25 26 27 |
# File 'lib/parliament/grom/decorator/government_incumbency.rb', line 25 def current? end_date.nil? end |
#end_date ⇒ DateTime?
Alias incumbencyEndDate with fallback.
18 19 20 |
# File 'lib/parliament/grom/decorator/government_incumbency.rb', line 18 def end_date @end_date ||= respond_to?(:incumbencyEndDate) ? DateTime.parse(incumbencyEndDate) : nil end |
#government_position ⇒ Grom::Node?
Alias governmentIncumbencyHasGovernmentPosition with fallback.
32 33 34 |
# File 'lib/parliament/grom/decorator/government_incumbency.rb', line 32 def government_position respond_to?(:governmentIncumbencyHasGovernmentPosition) ? governmentIncumbencyHasGovernmentPosition&.first : nil end |
#start_date ⇒ DateTime?
Alias incumbencyStartDate with fallback.
11 12 13 |
# File 'lib/parliament/grom/decorator/government_incumbency.rb', line 11 def start_date @start_date ||= respond_to?(:incumbencyStartDate) ? DateTime.parse(incumbencyStartDate) : nil end |