Sha256: 68661e3bb0220cb2e3bca51452f6f36490c5712b4f52b42b20e54bab2c8e0df6

Contents?: true

Size: 1.23 KB

Versions: 19

Compression:

Stored size: 1.23 KB

Contents

module GroupDocs
  class Questionnaire::Page < GroupDocs::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

19 entries across 19 versions & 1 rubygems

Version Path
groupdocs-0.3.11 lib/groupdocs/questionnaire/page.rb
groupdocs-0.3.10 lib/groupdocs/questionnaire/page.rb
groupdocs-0.3.9 lib/groupdocs/questionnaire/page.rb
groupdocs-0.3.8 lib/groupdocs/questionnaire/page.rb
groupdocs-0.3.7 lib/groupdocs/questionnaire/page.rb
groupdocs-0.3.6 lib/groupdocs/questionnaire/page.rb
groupdocs-0.3.5 lib/groupdocs/questionnaire/page.rb
groupdocs-0.3.0 lib/groupdocs/questionnaire/page.rb
groupdocs-0.2.11 lib/groupdocs/questionnaire/page.rb
groupdocs-0.2.10 lib/groupdocs/questionnaire/page.rb
groupdocs-0.2.9 lib/groupdocs/questionnaire/page.rb
groupdocs-0.2.8 lib/groupdocs/questionnaire/page.rb
groupdocs-0.2.7 lib/groupdocs/questionnaire/page.rb
groupdocs-0.2.6 lib/groupdocs/questionnaire/page.rb
groupdocs-0.2.5 lib/groupdocs/questionnaire/page.rb
groupdocs-0.2.4 lib/groupdocs/questionnaire/page.rb
groupdocs-0.2.3 lib/groupdocs/questionnaire/page.rb
groupdocs-0.2.2 lib/groupdocs/questionnaire/page.rb
groupdocs-0.2.1 lib/groupdocs/questionnaire/page.rb