Sha256: 085b8e36beb8398a1fea7352c2c03da90c2bf2954cdccc96e48deaa4b9c8f02f

Contents?: true

Size: 1.22 KB

Versions: 34

Compression:

Stored size: 1.22 KB

Contents

module GroupDocs
  class Questionnaire::Page < Api::Entity

    # @attr [Integer] number
    attr_accessor :number
    # @attr [String] title
    attr_accessor :title
    # @attr [Array<GroupDocs::Questionnaire::Question>] questions
    attr_accessor :questions

    #
    # Converts each question to GroupDocs::Questionnaire::Question object.
    #
    # @param [Array<GroupDocs::Questionnaire::Question, Hash>] questions
    #
    def questions=(questions)
      if questions
        @questions = questions.map do |question|
          if question.is_a?(GroupDocs::Questionnaire::Question)
            question
          else
            Questionnaire::Question.new(question)
          end
        end
      end
    end

    #
    # Adds question to page.
    #
    # @param [GroupDocs::Questionnaire::Question] question
    # @raise [ArgumentError] if question is not GroupDocs::Questionnaire::Question object
    #
    def add_question(question)
      question.is_a?(GroupDocs::Questionnaire::Question) or raise ArgumentError,
        "Question should be GroupDocs::Questionnaire::Question object, received: #{question.inspect}"

      @questions ||= Array.new
      @questions << question
    end

  end # Questionnaire::Page
end # GroupDocs

Version data entries

34 entries across 34 versions & 1 rubygems

Version Path
groupdocs-2.2.0 lib/groupdocs/questionnaire/page.rb
groupdocs-2.1.0 lib/groupdocs/questionnaire/page.rb
groupdocs-2.0.0 lib/groupdocs/questionnaire/page.rb
groupdocs-1.9.0 lib/groupdocs/questionnaire/page.rb
groupdocs-1.8.1 lib/groupdocs/questionnaire/page.rb
groupdocs-1.8.0 lib/groupdocs/questionnaire/page.rb
groupdocs-1.7.0 lib/groupdocs/questionnaire/page.rb
groupdocs-1.6.0 lib/groupdocs/questionnaire/page.rb
groupdocs-1.5.9 lib/groupdocs/questionnaire/page.rb
groupdocs-1.5.8 lib/groupdocs/questionnaire/page.rb
groupdocs-1.5.7 lib/groupdocs/questionnaire/page.rb
groupdocs-1.5.6 lib/groupdocs/questionnaire/page.rb
groupdocs-1.5.5 lib/groupdocs/questionnaire/page.rb
groupdocs-1.5.4 lib/groupdocs/questionnaire/page.rb
groupdocs-1.5.3 lib/groupdocs/questionnaire/page.rb
groupdocs-1.5.2 lib/groupdocs/questionnaire/page.rb
groupdocs-1.5.1 lib/groupdocs/questionnaire/page.rb
groupdocs-1.5.0 lib/groupdocs/questionnaire/page.rb
groupdocs-1.4.2 lib/groupdocs/questionnaire/page.rb
groupdocs-1.4.1 lib/groupdocs/questionnaire/page.rb