Module: Ext::Controls::Views
- Defined in:
- lib/ext/controls.rb
Instance Method Summary collapse
- #_control_for(thing, opts = {}) ⇒ Object
- #_text_control(str, opts = {}) ⇒ Object (also: #_string_control, #_numeric_control)
Instance Method Details
#_control_for(thing, opts = {}) ⇒ Object
11 12 13 14 15 16 17 18 19 |
# File 'lib/ext/controls.rb', line 11 def _control_for(thing, opts={}) thing.class.ancestors.each do |a| m = '_' + a.name.gsub('::', '__').downcase + '_control' if respond_to? m return send(m, name, thing) end end return "No control for #{thing}" end |
#_text_control(str, opts = {}) ⇒ Object Also known as: _string_control, _numeric_control
21 22 23 |
# File 'lib/ext/controls.rb', line 21 def _text_control(str, opts={}) input {:type=>'text', :value=>str}.merge(opts) end |