Sha256: e1e755d1b8c2269a5569d3dd1abfa92fd2079d122ad68e2f14869520725535b8
Contents?: true
Size: 1.23 KB
Versions: 10
Compression:
Stored size: 1.23 KB
Contents
module Parliament module Grom module Decorator # Decorator namespace for Grom::Node instances with type: https://id.parliament.uk/schema/Answer. module Answer include Helpers::DateHelper # Alias answerText with fallback. # # @return [String, String] the text of the Grom::Node or an empty string. def text respond_to?(:answerText) ? answerText : '' end # Alias answerGivenDate with fallback. # # @return [DateTime, nil] the answer date of the Grom::Node or nil. def answer_given_date @answer_given_date ||= respond_to?(:answerGivenDate) ? DateTime.parse(answerGivenDate) : nil end # Alias answerHasAnsweringPerson with fallback. # # @return [Grom::Node, nil] the answering_person of the Grom::Node or nil. def answering_person respond_to?(:answerHasAnsweringPerson) ? answerHasAnsweringPerson.first : nil end # Alias answerHasQuestion with fallback. # # @return [Grom::Node, nil] the question of the Grom::Node or nil. def question respond_to?(:answerHasQuestion) ? answerHasQuestion.first : nil end end end end end
Version data entries
10 entries across 10 versions & 1 rubygems