class GroupDocs::Questionnaire::Question

Constants

TYPES

Attributes

acceptableValues[RW]

@attr [Array<String>] acceptableValues

answers[RW]

@attr [Array<Hash>] answers

conditions[RW]

@attr [Array<GroupDocs::Questionnaire::Question::Conditions>] conditions

def_answer[RW]

@attr [String] def_answer

dimension[RW]

@attr [Array<String>] dimension

disabled[RW]

added in release 1.5.8

@attr [Boolean] disabled

field[RW]

@attr [String] field

hint[RW]

@attr [String] hint

max_length[RW]

@attr [Integer] max_length

rect[RW]

@attr [GroupDocs::Document::Rectangle] rect

regionName[RW]

added in release 1.7.0

@attr [String] regionName

required[RW]

@attr [Boolean] required

text[RW]

@attr [String] text

type[RW]

@attr [Symbol] type

Public Instance Methods

add_answer(answer) click to toggle source

Adds answer to the question.

@param [GroupDocs::Questionnaire::Question::Answer] answer @raise [ArgumentError] if answer is not GroupDocs::Questionnaire::Question::Answer object

# File lib/groupdocs/questionnaire/question.rb, line 75
def add_answer(answer)
  answer.is_a?(GroupDocs::Questionnaire::Question::Answer) or raise ArgumentError,
    "Answer should be GroupDocs::Questionnaire::Question::Answer object, received: #{answer.inspect}"

  @answers ||= Array.new
  @answers << answer
end
answers=(answers) click to toggle source

Converts each answer to GroupDocs::Questionnaire::Question::Answer object.

@param [Array<Hash>] answers

# File lib/groupdocs/questionnaire/question.rb, line 57
def answers=(answers)
  if answers
    @answers = answers.map do |answer|
      if answer.is_a?(GroupDocs::Questionnaire::Question::Answer)
        answer
      else
        Questionnaire::Question::Answer.new(answer)
      end
    end
  end
end
type=(type) click to toggle source

Updates type with machine-readable format.

@param [Symbol] type @raise [ArgumentError] if type is unknown

# File lib/groupdocs/questionnaire/question.rb, line 89
def type=(type)
  if type.is_a?(Symbol)
    type = type.to_s.camelize
    TYPES.include?(type) or raise ArgumentError, "Unknown type: #{type.inspect}"
  end

  @type = type
end