Module: Interrogative::BaseMethods

Included in:
ClassMethods, InstanceMethods
Defined in:
lib/interrogative.rb

Overview

Methods applicable on both the class and instance levels.

Instance Method Summary collapse

Instance Method Details

#postprocess_question(question) ⇒ Object

Run the defined postprocessors on the given question.

Useful when you need to postprocess questions at a higher level.

Parameters:



21
22
23
24
25
26
27
# File 'lib/interrogative.rb', line 21

def postprocess_question(question)
  unless @_question_postprocessors.nil?
    @_question_postprocessors.each do |postprocessor|
      postprocessor.call(question)
    end
  end
end

#question(name, text, attrs = {}) ⇒ Question

Give a new question.

Parameters:

  • name (Symbol, String)

    the name (think ) of the question.

  • label (String)

    the text of the question (think

  • attrs (Hash) (defaults to: {})

    additional attributes for the question.

Options Hash (attrs):

  • :long (Boolean)

    whether the question has a long answer (think