Class: YuiOnRails::RadioButtons::RadioButtonsRenderer

Inherits:
Object
  • Object
show all
Defined in:
lib/yui-on-rails/radio_buttons.rb

Instance Method Summary collapse

Constructor Details

#initialize(name, options = {}) {|_self| ... } ⇒ RadioButtonsRenderer

Returns a new instance of RadioButtonsRenderer.

Yields:

  • (_self)

Yield Parameters:

Raises:

  • (ArgumentError)


11
12
13
14
15
16
17
18
# File 'lib/yui-on-rails/radio_buttons.rb', line 11

def initialize(name, options={}, &block )
  raise ArgumentError, "Missing block" unless block_given?
  @template = eval( 'self', block.binding )
  @options = 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(button_text,options={})
  raise "You must provide a button name dummy.#CREATE" if button_text.blank?
  @radio_buttons << [button_text, options]
end

#renderObject



25
26
27
# File 'lib/yui-on-rails/radio_buttons.rb', line 25

def render
  (:div,render_bodies,{:id=>"button_group", :class=>"yui-buttongroup"}.merge(@options))
end