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.

Since:

  • 0.1.0

Instance Method Summary collapse

Methods included from Helpers::DateHelper

#date_range

Instance Method Details

#end_dateDateTime?

Alias groupEndDate with fallback.

Since:

  • 0.1.0



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.

Since:

  • 0.1.0



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_countInteger?

Alias member count with fallback.

Since:

  • 0.1.0



24
25
26
# File 'lib/parliament/grom/decorator/group.rb', line 24

def member_count
  respond_to?(:memberCount) ? memberCount.to_i : nil
end

#nameString

Alias groupName with fallback.

Since:

  • 0.1.0



10
11
12
# File 'lib/parliament/grom/decorator/group.rb', line 10

def name
  respond_to?(:groupName) ? groupName : ''
end

#start_dateDateTime?

Alias groupStartDate with fallback.

Since:

  • 0.1.0



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