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

Defined in:
lib/parliament/grom/decorator/formal_body.rb

Overview

Decorator namespace for Grom::Node instances with type: id.ukpds.org/schema/FormalBody. rubocop:disable ModuleLength

Since:

  • 0.1.0

Instance Method Summary collapse

Instance Method Details

#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



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

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



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

def end_date
  @end_date ||= respond_to?(:formalBodyEndDate) ? DateTime.parse(formalBodyEndDate) : nil
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



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

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

#start_dateDateTime?

Alias formalBodyStartDate with fallback.

Returns:

  • (DateTime, nil)

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

Since:

  • 0.1.0



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

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