Sha256: 8f92e84b39dc0b963ab0e151ffe52529acd3aa72c8a4cbb7bf52046729f6e4f5
Contents?: true
Size: 1.72 KB
Versions: 3
Compression:
Stored size: 1.72 KB
Contents
module Parliament module Grom module Decorator # Decorator namespace for Grom::Node instances with type: https://id.parliament.uk/schema/WorkPackageableThing module WorkPackageableThing include Helpers::DateHelper # Alias workPackageableThingName with fallback. # # @return [String, String] the name of the Grom::Node or an empty string. def name respond_to?(:workPackageableThingName) ? workPackageableThingName : '' end # Alias workPackageableThingHasWorkPackage with fallback. # NB: Currently, a work packageable thing only has one work package # # @return [Grom::Node, nil] a WorkPackage Grom::Node or nil. def work_package respond_to?(:workPackageableThingHasWorkPackage) ? workPackageableThingHasWorkPackage.first : nil end # Alias workPackageableThingHasWorkPackage with fallback. # # @return [String, String] a web link or an empty string. def weblink respond_to?(:workPackageableThingHasWorkPackageableThingWebLink) ? workPackageableThingHasWorkPackageableThingWebLink : '' end # @return [Date, nil] an array of BusinessItem Grom::Nodes or an empty array. def oldest_business_item_date work_package&.oldest_business_item_date end # Alias workPackageableThingComingIntoForceDate with fallback. # # @return [DateTime, nil] the expiry date (time limit) of a work package or nil. def time_limit_for_objection_date respond_to?(:workPackageableThingTimeLimitForObjectionEndDate) ? DateTime.parse(workPackageableThingTimeLimitForObjectionEndDate) : nil end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems