Class: Mechanize::Form::MultiSelectList
- Inherits:
-
Object
- Object
- Mechanize::Form::MultiSelectList
- Defined in:
- lib/saber/mechanize_ext.rb
Instance Method Summary collapse
-
#select_all_with_tagen ⇒ Object
(also: #select_all)
Select all options.
-
#select_none_with_tagen ⇒ Object
(also: #select_none)
Select no options.
- #text_value ⇒ Object
- #text_value=(values) ⇒ Object
Instance Method Details
#select_all_with_tagen ⇒ Object Also known as: select_all
Select all options
71 72 73 74 |
# File 'lib/saber/mechanize_ext.rb', line 71 def select_all_with_tagen @text_value = [] select_all_withoutout_tagen end |
#select_none_with_tagen ⇒ Object Also known as: select_none
Select no options
63 64 65 66 |
# File 'lib/saber/mechanize_ext.rb', line 63 def select_none_with_tagen @text_value = [] select_none_without_tagen end |
#text_value ⇒ Object
78 79 80 81 82 83 |
# File 'lib/saber/mechanize_ext.rb', line 78 def text_value value = [] value.concat @text_value value.concat .map { |o| o.text } value end |
#text_value=(values) ⇒ Object
85 86 87 88 89 90 91 92 93 94 95 |
# File 'lib/saber/mechanize_ext.rb', line 85 def text_value=(values) select_none [values].flatten.each do |value| option = .find { |o| o.text == value } if option.nil? @text_value.push(value) else option.select end end end |