Module: Fluent::DataSetter
- Included in:
- Fluent
- Defined in:
- lib/fluent/data_setter.rb
Instance Method Summary collapse
- #object_enabled_for(key) ⇒ Object
- #text_settable_for(key) ⇒ Object
- #use_check_data_with(key, value) ⇒ Object
- #use_select_data_with(key, value) ⇒ Object
- #use_set_data_with(key, value) ⇒ Object
- #use_text_data_with(key, value) ⇒ Object
- #using(data) ⇒ Object (also: #using_data, #use_data, #using_values, #use_values)
-
#value_checkable_for(key) ⇒ Object
The _for methods should use a unique signature for referring to a particular element action.
-
#value_selectable_for(key) ⇒ Object
Only a select list can respond to a suffix of ‘select_’.
-
#value_settable_for(key) ⇒ Object
Only a radio can respond to a prefix of ‘set_’.
Instance Method Details
#object_enabled_for(key) ⇒ Object
57 58 59 60 |
# File 'lib/fluent/data_setter.rb', line 57 def object_enabled_for(key) web_element = self.send("#{key}_element") web_element.enabled? and web_element.visible? end |
#text_settable_for(key) ⇒ Object
53 54 55 |
# File 'lib/fluent/data_setter.rb', line 53 def text_settable_for(key) respond_to?("#{key}=".to_sym) end |
#use_check_data_with(key, value) ⇒ Object
23 24 25 26 |
# File 'lib/fluent/data_setter.rb', line 23 def use_check_data_with(key, value) return self.send "#{key}_check" if value return self.send "#{key}_uncheck" end |
#use_select_data_with(key, value) ⇒ Object
28 29 30 |
# File 'lib/fluent/data_setter.rb', line 28 def use_select_data_with(key, value) self.send "#{key}_select" if value end |
#use_set_data_with(key, value) ⇒ Object
32 33 34 |
# File 'lib/fluent/data_setter.rb', line 32 def use_set_data_with(key, value) self.send "set_#{key}" if value end |
#use_text_data_with(key, value) ⇒ Object
19 20 21 |
# File 'lib/fluent/data_setter.rb', line 19 def use_text_data_with(key, value) self.send "#{key}_set", value end |
#using(data) ⇒ Object Also known as: using_data, use_data, using_values, use_values
5 6 7 8 9 10 11 12 |
# File 'lib/fluent/data_setter.rb', line 5 def using(data) data.each do |key, value| use_select_data_with(key, value) if value_selectable_for(key) and object_enabled_for(key) use_check_data_with(key, value) if value_checkable_for(key) and object_enabled_for(key) use_set_data_with(key, value) if value_settable_for(key) and object_enabled_for(key) use_text_data_with(key, value) if text_settable_for(key) and object_enabled_for(key) end end |
#value_checkable_for(key) ⇒ Object
The _for methods should use a unique signature for referring to a particular element action.
39 40 41 |
# File 'lib/fluent/data_setter.rb', line 39 def value_checkable_for(key) respond_to?("#{key}_check".to_sym) end |
#value_selectable_for(key) ⇒ Object
Only a select list can respond to a suffix of ‘select_’
44 45 46 |
# File 'lib/fluent/data_setter.rb', line 44 def value_selectable_for(key) respond_to?("#{key}_select".to_sym) end |
#value_settable_for(key) ⇒ Object
Only a radio can respond to a prefix of ‘set_’
49 50 51 |
# File 'lib/fluent/data_setter.rb', line 49 def value_settable_for(key) respond_to?("set_#{key}".to_sym) end |