Module: Parliament::Grom::Decorator::FormalBody

Includes:
Helpers::DateHelper
Defined in:
lib/parliament/grom/decorator/formal_body.rb

Overview

Decorator namespace for Grom::Node instances with type: id.parliament.uk/schema/FormalBody.

Since:

  • 0.1.0

Instance Method Summary collapse

Methods included from Helpers::DateHelper

#date_range

Instance Method Details

#contact_pointsArray

Checks if Grom::Node has contact points.

Returns:

  • (Array, Array)

    an arry containing the contact_point(s), or an empty array.

Since:

  • 0.1.0



60
61
62
# File 'lib/parliament/grom/decorator/formal_body.rb', line 60

def contact_points
  @contact_points ||= respond_to?(:formalBodyHasContactPoint) ? Array(formalBodyHasContactPoint) : []
end

#current?Boolean

Checks if Grom::Node has an end date.

Returns:

  • (Boolean)

    a boolean depending on whether or not the Grom::Node has an end date.

Since:

  • 0.1.0



53
54
55
# File 'lib/parliament/grom/decorator/formal_body.rb', line 53

def current?
  end_date.nil?
end

#end_dateDateTime?

Alias formalBodyEndDate with fallback.

Returns:

  • (DateTime, nil)

    the end date of the Grom::Node or nil.

Since:

  • 0.1.0



46
47
48
# File 'lib/parliament/grom/decorator/formal_body.rb', line 46

def end_date
  @end_date ||= respond_to?(:formalBodyEndDate) ? DateTime.parse(formalBodyEndDate) : nil
end

#has_chair?Boolean

Checks if Grom::Node has a chair.

Returns:

  • (Boolean)

    a boolean depending on whether or not the Grom::Node is chair.

Since:

  • 0.1.0



18
19
20
# File 'lib/parliament/grom/decorator/formal_body.rb', line 18

def has_chair?
  respond_to?(:formalBodyHasFormalBodyChair)
end

#joint?Boolean

Checks if Grom::Node is joint.

Returns:

  • (Boolean)

    a boolean depending on whether or not the Grom::Node is joint.

Since:

  • 0.1.0



39
40
41
# File 'lib/parliament/grom/decorator/formal_body.rb', line 39

def joint?
  respond_to?(:formalBodyHasLeadHouse)
end

#nameString

Checks if Grom::Node has a name.

Returns:

  • (String, String)

    a string depending on whether or not the Grom::Node has a name.

Since:

  • 0.1.0



11
12
13
# File 'lib/parliament/grom/decorator/formal_body.rb', line 11

def name
  @name ||= respond_to?(:formalBodyName) ? formalBodyName : ''
end

#remitString

Checks if Grom::Node has a remit.

Returns:

  • (String, String)

    a string depending on whether or not the Grom::Node has a remit.

Since:

  • 0.1.0



32
33
34
# File 'lib/parliament/grom/decorator/formal_body.rb', line 32

def remit
  @remit ||= respond_to?(:formalBodyRemit) ? formalBodyRemit : ''
end

#start_dateDateTime?

Alias formalBodyStartDate with fallback.

Returns:

  • (DateTime, nil)

    the start date of the Grom::Node or nil.

Since:

  • 0.1.0



25
26
27
# File 'lib/parliament/grom/decorator/formal_body.rb', line 25

def start_date
  @start_date ||= respond_to?(:formalBodyStartDate) ? DateTime.parse(formalBodyStartDate) : nil
end