Sha256: 391dc8d087bcc0463582a831fe9da975b08a845e94c58753c4b520ff8f8ef1f1
Contents?: true
Size: 1002 Bytes
Versions: 2
Compression:
Stored size: 1002 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 { |e| e.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 { |e| e.value }.compact end # # Returns true if the select list has one or more options where text or label matches the given value. # # @param [String, Regexp] value A value # @return [Boolean] def include? value element.include? value end end Druid::Elements.tag_to_class[:select] = Druid::Elements::SelectList end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
druid-ts-1.2.4 | lib/druid/elements/select_list.rb |
druid-ts-1.2.3 | lib/druid/elements/select_list.rb |