Method: Wee::Brush::SelectListTag#__callback
- Defined in:
- lib/wee/html_brushes.rb
#__callback ⇒ Object
552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 |
# File 'lib/wee/html_brushes.rb', line 552 def __callback # # A callback was specified. We have to wrap it inside another # callback, as we want to perform some additional actions. # name(@canvas.register_callback(:input, proc {|input| input = [input] unless input.kind_of?(Array) choosen = input.map {|idx| get_item(idx) } if @attributes.has_key?(:multiple) @callback.call(choosen) elsif choosen.size > 1 raise "more than one element was choosen from a not-multiple SelectListTag" else @callback.call(choosen.first) end })) end |