Module: Interrogative::InstanceMethods
- Includes:
- BaseMethods
- Defined in:
- lib/interrogative.rb
Overview
Methods tailored to the instance level.
These handle getting questions from the class level.
Instance Method Summary collapse
-
#questions ⇒ Array<Question>
Get the array of all noted questions for this instance and its class (and all of its superclasses), bound to this instance.
Methods included from BaseMethods
#postprocess_question, #question, #when_questioned
Instance Method Details
#questions ⇒ Array<Question>
Get the array of all noted questions for this instance and its class (and all of its superclasses), bound to this instance.
All questions will be bound to the instance on which questions
is called, so their instance_block
s, if provided, will be evaluated
in its context.
86 87 88 89 90 91 |
# File 'lib/interrogative.rb', line 86 def questions qs = [] qs |= self.class.questions if self.class.respond_to? :questions qs |= (@_questions||=[]) qs.map{|q| q.for_instance(self) } end |