Class: Campo::Textarea

Inherits:
Base
  • Object
show all
Defined in:
lib/campo.rb

Constant Summary collapse

DEFAULT =
{ cols: 40, rows: 10, tabindex: %q!#{i += 1}! }

Instance Attribute Summary

Attributes inherited from Base

#attributes, #fields

Attributes included from Childish

#parent

Instance Method Summary collapse

Methods inherited from Base

#labelled, #on_output, #output, output, quotable, unhash

Methods included from Convenience

#bit_of_ruby, #checkbox, #fieldset, #input, #literal, #radio, #select, #submit, #text, #textarea

Methods included from Iding

#id_tag

Methods included from Childish

#push=

Constructor Details

#initialize(name, inner = nil, attributes = {}) ⇒ Textarea

Returns a new instance of Textarea.



509
510
511
512
513
514
515
516
517
518
519
# File 'lib/campo.rb', line 509

def initialize( name,  inner=nil, attributes={} )
  if inner.kind_of? Hash
    attributes = inner
    inner = nil
  end
  super( name, DEFAULT.merge( attributes ) )
  @inner = inner
  self.on_output do |n=0, tab=2|
    %Q!#{" " * n * tab}%textarea{ atts[:#{name.gsub(/\W/, "_")}], #{Base.unhash( @attributes )} }= inners[:#{name.gsub(/\W/, "_")}] !
  end
end