Class: Mechanize::Form::SelectList

Inherits:
Object
  • Object
show all
Defined in:
lib/saber/mechanize_ext.rb

Instance Method Summary collapse

Instance Method Details

#text_valueObject



99
100
101
102
103
104
105
106
107
108
# File 'lib/saber/mechanize_ext.rb', line 99

def text_value
  value = super
  if value.length > 0
    value.last
  elsif @options.length > 0
    @options.first.value
  else
    nil
  end
end

#text_value=(new) ⇒ Object



110
111
112
113
114
115
116
# File 'lib/saber/mechanize_ext.rb', line 110

def text_value=(new)
  if new != new.to_s and new.respond_to? :first
    super([new.first])
  else
    super([new.to_s])
  end
end