Class: Aurita::GUI::Textarea_Field

Inherits:
Form_Field show all
Defined in:
lib/aurita-gui/form/textarea_field.rb

Instance Attribute Summary

Attributes inherited from Form_Field

#data_type, #form, #hidden, #hint, #invalid, #label, #required, #type, #value

Attributes inherited from Element

#attrib, #force_closing_tag, #parent, #tag

Instance Method Summary collapse

Methods inherited from Form_Field

#disable!, #disabled=, #editable!, #enable!, #hidden?, #hide!, #invalid!, #invalid?, #optional!, #readonly!, #readonly=, #readonly?, #readonly_element, #required!, #required?, #show!, #to_hidden_field, #to_s

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

#marshal_load

Methods included from Marshal_Helper

#marshal_dump

Constructor Details

#initialize(params, &block) ⇒ Textarea_Field

Returns a new instance of Textarea_Field.



8
9
10
11
12
13
14
15
# File 'lib/aurita-gui/form/textarea_field.rb', line 8

def initialize(params, &block)
  params[:tag] = :textarea
  # Move value parameter to @content: 
  @value       = params[:value]
  super(params)
  params.delete(:value)
  @value       = yield.to_s if block_given?
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Aurita::GUI::Element

Instance Method Details

#elementObject



16
17
18
19
20
# File 'lib/aurita-gui/form/textarea_field.rb', line 16

def element
  # Always close <textarea> tags! 
  @attrib[:force_closing_tag] = true
  HTML.textarea(@attrib) { @value.to_s }
end