Class: YuiOnRails::Tabs::TabsRenderer
- Inherits:
-
Object
- Object
- YuiOnRails::Tabs::TabsRenderer
show all
- Defined in:
- lib/yui-on-rails/tabs.rb
Instance Method Summary
collapse
Constructor Details
#initialize(options = {}) {|_self| ... } ⇒ TabsRenderer
Returns a new instance of TabsRenderer.
12
13
14
15
16
17
18
|
# File 'lib/yui-on-rails/tabs.rb', line 12
def initialize( options={}, &block )
raise ArgumentError, "Missing block" unless block_given?
@template = eval( 'self', block.binding )
@options = options
@tabs = []
yield self
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(*args, &block) ⇒ Object
46
47
48
|
# File 'lib/yui-on-rails/tabs.rb', line 46
def method_missing( *args, &block )
@template.send( *args, &block )
end
|
Instance Method Details
#create(tab_id, tab_text, li_options = {}, options = {}, &block) ⇒ Object
20
21
22
23
|
# File 'lib/yui-on-rails/tabs.rb', line 20
def create(tab_id,tab_text,li_options={},options={},&block)
raise "Block needed for TabsRenderer#CREATE" unless block_given?
@tabs << [ tab_id, tab_text, options, block, li_options ]
end
|
#render ⇒ Object
25
26
27
|
# File 'lib/yui-on-rails/tabs.rb', line 25
def render
content_tag(:div,(render_tabs+render_bodies),{:id=>:tabs, :class=>"tabber"}.merge(@options))
end
|