Module: Parliament::Grom::Decorator::Group
- Includes:
- Helpers::DateHelper
- Defined in:
- lib/parliament/grom/decorator/group.rb
Overview
Decorator namespace for Grom::Node instances with type: id.parliament.uk/schema/Group.
Instance Method Summary collapse
-
#end_date ⇒ DateTime?
Alias groupEndDate with fallback.
-
#formal_body? ⇒ Boolean
Whether the group is also a formal body.
-
#member_count ⇒ Integer?
Alias member count with fallback.
-
#name ⇒ String
Alias groupName with fallback.
-
#start_date ⇒ DateTime?
Alias groupStartDate with fallback.
Methods included from Helpers::DateHelper
Instance Method Details
#end_date ⇒ DateTime?
Alias groupEndDate with fallback.
31 32 33 |
# File 'lib/parliament/grom/decorator/group.rb', line 31 def end_date @end_date ||= respond_to?(:groupEndDate) ? DateTime.parse(groupEndDate) : nil end |
#formal_body? ⇒ Boolean
Returns whether the group is also a formal body.
36 37 38 |
# File 'lib/parliament/grom/decorator/group.rb', line 36 def formal_body? type.include?('https://id.parliament.uk/schema/FormalBody') end |
#member_count ⇒ Integer?
Alias member count with fallback.
24 25 26 |
# File 'lib/parliament/grom/decorator/group.rb', line 24 def member_count respond_to?(:memberCount) ? memberCount.to_i : nil end |
#name ⇒ String
Alias groupName with fallback.
10 11 12 |
# File 'lib/parliament/grom/decorator/group.rb', line 10 def name respond_to?(:groupName) ? groupName : '' end |
#start_date ⇒ DateTime?
Alias groupStartDate with fallback.
17 18 19 |
# File 'lib/parliament/grom/decorator/group.rb', line 17 def start_date @start_date ||= respond_to?(:groupStartDate) ? DateTime.parse(groupStartDate) : nil end |