Module: Parliament::Grom::Decorator::Question
- Includes:
- Helpers::DateHelper
- Defined in:
- lib/parliament/grom/decorator/question.rb
Overview
Decorator namespace for Grom::Node instances with type: id.parliament.uk/schema/Question.
Instance Method Summary collapse
-
#answering_body_allocation ⇒ Grom::Node?
Alias questionHasAnsweringBodyAllocation with fallback.
-
#answers ⇒ Array
Alias questionHasAnswer with fallback.
-
#asked_at_date ⇒ DateTime?
Alias questionAskedAt with fallback.
-
#asking_person ⇒ Grom::Node?
Alias questionHasAskingPerson with fallback.
-
#text ⇒ String
Alias questionText with fallback.
-
#uin ⇒ String
Alias eqmUin with fallback.
Methods included from Helpers::DateHelper
Instance Method Details
#answering_body_allocation ⇒ Grom::Node?
Alias questionHasAnsweringBodyAllocation with fallback.
45 46 47 |
# File 'lib/parliament/grom/decorator/question.rb', line 45 def answering_body_allocation respond_to?(:questionHasAnsweringBodyAllocation) ? questionHasAnsweringBodyAllocation.first : nil end |
#answers ⇒ Array
Alias questionHasAnswer with fallback.
38 39 40 |
# File 'lib/parliament/grom/decorator/question.rb', line 38 def answers respond_to?(:questionHasAnswer) ? questionHasAnswer : [] end |
#asked_at_date ⇒ DateTime?
Alias questionAskedAt with fallback.
24 25 26 |
# File 'lib/parliament/grom/decorator/question.rb', line 24 def asked_at_date @asked_at_date ||= respond_to?(:questionAskedAt) ? DateTime.parse(questionAskedAt) : nil end |
#asking_person ⇒ Grom::Node?
Alias questionHasAskingPerson with fallback.
31 32 33 |
# File 'lib/parliament/grom/decorator/question.rb', line 31 def asking_person respond_to?(:questionHasAskingPerson) ? questionHasAskingPerson.first : nil end |
#text ⇒ String
Alias questionText with fallback.
10 11 12 |
# File 'lib/parliament/grom/decorator/question.rb', line 10 def text respond_to?(:questionText) ? questionText : '' end |
#uin ⇒ String
Alias eqmUin with fallback.
17 18 19 |
# File 'lib/parliament/grom/decorator/question.rb', line 17 def uin respond_to?(:eqmUin) ? eqmUin : '' end |