Class: TabBuilder::TabSet
- Inherits:
-
Object
- Object
- TabBuilder::TabSet
- Includes:
- Enumerable
- Defined in:
- lib/tab_builder/tab_set.rb
Instance Attribute Summary collapse
-
#options ⇒ Object
Returns the value of attribute options.
Instance Method Summary collapse
- #add(tab) ⇒ Object (also: #<<)
- #draw(&block) ⇒ Object
- #each ⇒ Object
-
#initialize(options, context, &block) ⇒ TabSet
constructor
A new instance of TabSet.
- #method_missing(name, *args, &block) ⇒ Object
Constructor Details
#initialize(options, context, &block) ⇒ TabSet
Returns a new instance of TabSet.
7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/tab_builder/tab_set.rb', line 7 def initialize(, context, &block) @options = .to_openhash || OpenHash.new @context = context @tabs = [] # Copy over context instance variables @context.instance_variables.each do |iv| instance_variable_set(iv, @context.instance_variable_get(iv)) unless instance_variable_defined? iv end instance_eval &block if block_given? end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
Instance Attribute Details
#options ⇒ Object
Returns the value of attribute options.
5 6 7 |
# File 'lib/tab_builder/tab_set.rb', line 5 def @options end |
Instance Method Details
#add(tab) ⇒ Object Also known as: <<
24 25 26 |
# File 'lib/tab_builder/tab_set.rb', line 24 def add(tab) @tabs << tab end |
#draw(&block) ⇒ Object
29 30 31 |
# File 'lib/tab_builder/tab_set.rb', line 29 def draw(&block) Drawer.draw(self, @context, &block) end |
#each ⇒ Object
20 21 22 |
# File 'lib/tab_builder/tab_set.rb', line 20 def each @tabs.each { |i| yield i } end |