class Forme::Tag

  1. lib/forme/tag.rb
Superclass: Object

Low level abstract tag form, where each instance represents a html tag with attributes and children.

Methods

Public Class

  1. new

Public Instance

  1. <<
  2. attr
  3. children
  4. form
  5. tag
  6. to_s
  7. type

Attributes

attr [R]

The attributes hash of this receiver.

children [R]

An array instance representing the children of the receiver, or possibly nil if the receiver has no children.

form [R]

The Form object related to the receiver.

type [R]

The type of tag, should be a symbol (e.g. :input, :select).

Public Class methods

new (form, type, attr={}, children=nil)

Set the form, type, attr, and children.

[show source]
   # File lib/forme/tag.rb
21 def initialize(form, type, attr={}, children=nil)
22   @form, @type, @attr = form, type, (attr||{})
23   @children = parse_children(children)
24 end

Public Instance methods

<< (child)

Adds a child to the array of receiver's children.

[show source]
   # File lib/forme/tag.rb
27 def <<(child)
28   if children
29     children << child
30   else
31     @children = [child]
32   end
33 end
tag (*a, &block)

Create a new Tag instance with the given arguments and block related to the receiver's form.

[show source]
   # File lib/forme/tag.rb
37 def tag(*a, &block)
38   form._tag(*a, &block)
39 end
to_s ()

Return a string containing the serialized content of the receiver.

[show source]
   # File lib/forme/tag.rb
42 def to_s
43   form.raw_output(Forme.transform(:serializer, @opts, @form.opts, self))
44 end