Class: Aurita::GUI::Fieldset
- Defined in:
- lib/aurita-gui/form/fieldset.rb
Instance Attribute Summary collapse
-
#label ⇒ Object
(also: #legend)
Returns the value of attribute label.
-
#legend ⇒ Object
(also: #set_legend, #label=)
Sets the attribute legend.
-
#name ⇒ Object
Returns the value of attribute name.
Attributes inherited from Element
#attrib, #force_closing_tag, #parent, #tag
Instance Method Summary collapse
- #add(field_element) ⇒ Object
- #content ⇒ Object
-
#initialize(params, &block) ⇒ Fieldset
constructor
A new instance of Fieldset.
Methods inherited from Element
#+, #<<, #[], #[]=, #add_class, #clear_floating, #css_classes, #find_by_dom_id, #get_content, #has_content?, #id, #id=, #method_missing, #recurse, #remove_class, #set_content, #string, #swap, #to_ary, #type=
Methods included from Marshal_Helper_Class_Methods
Methods included from Marshal_Helper
Constructor Details
#initialize(params, &block) ⇒ Fieldset
Returns a new instance of Fieldset.
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/aurita-gui/form/fieldset.rb', line 10 def initialize(params, &block) params[:tag] = :fieldset @name = params[:name] @elements = [] if block_given? then yield.each { |field_element| add(field_element) } end legend_element = params[:legend] legend_element ||= params[:label] set_legend(legend_element) params.delete(:legend) params.delete(:label) params.delete(:name) super(params, &block) end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Aurita::GUI::Element
Instance Attribute Details
#label ⇒ Object Also known as: legend
Returns the value of attribute label.
8 9 10 |
# File 'lib/aurita-gui/form/fieldset.rb', line 8 def label @label end |
#legend=(field) ⇒ Object Also known as: set_legend, label=
Sets the attribute legend
8 9 10 |
# File 'lib/aurita-gui/form/fieldset.rb', line 8 def legend=(value) @legend = value end |
#name ⇒ Object
Returns the value of attribute name.
8 9 10 |
# File 'lib/aurita-gui/form/fieldset.rb', line 8 def name @name end |
Instance Method Details
#add(field_element) ⇒ Object
39 40 41 |
# File 'lib/aurita-gui/form/fieldset.rb', line 39 def add(field_element) @elements << field_element end |
#content ⇒ Object
43 44 45 46 47 48 49 50 |
# File 'lib/aurita-gui/form/fieldset.rb', line 43 def content if @legend then @content = [ @legend, @elements ] else @content = @elements end return @content end |