Class: YuiOnRails::RadioButtons::RadioButtonsRenderer
- Inherits:
-
Object
- Object
- YuiOnRails::RadioButtons::RadioButtonsRenderer
- Defined in:
- lib/yui-on-rails/radio_buttons.rb
Instance Method Summary collapse
- #create(button_text, options = {}) ⇒ Object
-
#initialize(name, options = {}) {|_self| ... } ⇒ RadioButtonsRenderer
constructor
A new instance of RadioButtonsRenderer.
- #render ⇒ Object
Constructor Details
#initialize(name, options = {}) {|_self| ... } ⇒ RadioButtonsRenderer
Returns a new instance of RadioButtonsRenderer.
11 12 13 14 15 16 17 18 |
# File 'lib/yui-on-rails/radio_buttons.rb', line 11 def initialize(name, ={}, &block ) raise ArgumentError, "Missing block" unless block_given? @template = eval( 'self', block.binding ) @options = @name = name @radio_buttons = [] yield self end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(*args, &block) ⇒ Object (private)
end
37 38 39 |
# File 'lib/yui-on-rails/radio_buttons.rb', line 37 def method_missing( *args, &block ) @template.send( *args, &block ) end |
Instance Method Details
#create(button_text, options = {}) ⇒ Object
20 21 22 23 |
# File 'lib/yui-on-rails/radio_buttons.rb', line 20 def create(,={}) raise "You must provide a button name dummy.#CREATE" if .blank? @radio_buttons << [, ] end |
#render ⇒ Object
25 26 27 |
# File 'lib/yui-on-rails/radio_buttons.rb', line 25 def render content_tag(:div,render_bodies,{:id=>"button_group", :class=>"yui-buttongroup"}.merge(@options)) end |