Sha256: 83842d555f426932d53d91d0012e7a4baf837637db858789babce7a92c683f88
Contents?: true
Size: 1.17 KB
Versions: 2
Compression:
Stored size: 1.17 KB
Contents
module Druid module Elements class SelectList < Element def self.finders super + [:value, :text] end def [](idx) Druid::Elements::Option.new(options[idx]) end def options element.options end # # Select a value from the list # def select(value) element.select(value) end # # @return [Array<sTRING>] An array of strings representing the text value of the currently selected options. # def selected_options element.selected_options.map { |e| e.text }.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 # # Returns true if any of the selected options' text or label match the given value. # @param [String, Regexp] value A value # @return [Boolean] def selected? value element.selected? 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.1.3 | lib/druid/elements/select_list.rb |
druid-ts-1.1.2 | lib/druid/elements/select_list.rb |