Sha256: a9165849455a2bc4889f8e6f76bfd02177da2e9e8aa650734a4ce0111243ce8f

Contents?: true

Size: 724 Bytes

Versions: 3

Compression:

Stored size: 724 Bytes

Contents

module Druid
  module Elements
    class SelectList < Element

      def [](idx)
        options[idx]
      end

      def options
        element.options.map { |e| Druid::Elements::Option.new(e)}
      end

      #
      # @return [Array<String>] An array of strings representing the text of the currently selected options.
      #
      def selected_options
        element.selected_options.map(&:text).compact
      end

      #
      # @return [Array<String>] An array of strings representing the value of the currently selected options.
      def selected_values
        element.selected_options.map(&:value).compact
      end

    end

    Druid::Elements.tag_to_class[:select] = Druid::Elements::SelectList
  end
end

Version data entries

3 entries across 3 versions & 2 rubygems

Version Path
druid-s-1.0.0 lib/druid/elements/select_list.rb
druid-ts-1.2.6 lib/druid/elements/select_list.rb
druid-ts-1.2.5 lib/druid/elements/select_list.rb