Sha256: 813f578e7d9bd6aa2a58c5b3f2e1325339065f0553d703808ad252bec437bfb1

Contents?: true

Size: 476 Bytes

Versions: 10

Compression:

Stored size: 476 Bytes

Contents

# frozen_string_literal: true

module Quby
  module Compiler
    module Entities
      module Questions
        class SelectQuestion < Question
          def as_json(options = {})
            super.merge(
              children: @options.as_json.compact, # for now just options, but we'll add optgroups later.
              placeholder: @options.find { _1.placeholder }&.description # nil for no placeholder
            )
          end
        end
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
quby-compiler-0.5.9 lib/quby/compiler/entities/questions/select_question.rb
quby-compiler-0.5.8 lib/quby/compiler/entities/questions/select_question.rb
quby-compiler-0.5.7 lib/quby/compiler/entities/questions/select_question.rb
quby-compiler-0.5.6 lib/quby/compiler/entities/questions/select_question.rb
quby-compiler-0.5.5 lib/quby/compiler/entities/questions/select_question.rb
quby-compiler-0.5.4 lib/quby/compiler/entities/questions/select_question.rb
quby-compiler-0.5.3 lib/quby/compiler/entities/questions/select_question.rb
quby-compiler-0.5.2 lib/quby/compiler/entities/questions/select_question.rb
quby-compiler-0.5.1 lib/quby/compiler/entities/questions/select_question.rb
quby-compiler-0.5.0 lib/quby/compiler/entities/questions/select_question.rb