class Forme::Tag

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

Low level abstract tag form, where each instance represents an HTML tag with attributes and children.

Methods

Public Class

  1. new

Public Instance

  1. attr
  2. children
  3. form
  4. tag
  5. to_s
  6. 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

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
28 def tag(*a, &block)
29   form._tag(*a, &block)
30 end
to_s()

Return a string containing the serialized content of the receiver.

[show source]
   # File lib/forme/tag.rb
33 def to_s
34   Forme.transform(:serializer, @opts, @form.opts, self)
35 end