Class: N::XhtmlBuilder

Inherits:
Object show all
Includes:
XhtmlBuilderMixin, XmlBuilderMixin
Defined in:
lib/nitro/builders/xhtml.rb

Overview

A class that encapsulats the XHTML generation functionality. Utilizes duck typing to redirect output to a target buffer.

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from XhtmlBuilderMixin

#options, #select

Methods included from XmlBuilderMixin

#comment, #end_tag, #method_missing, #start_tag, #text

Constructor Details

#initialize(target = '') ⇒ XhtmlBuilder

Returns a new instance of XhtmlBuilder.



100
101
102
# File 'lib/nitro/builders/xhtml.rb', line 100

def initialize(target = '')
	@target = target
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class N::XmlBuilderMixin

Instance Attribute Details

#targetObject

The target receives the generated xml, should respond_to :<<



98
99
100
# File 'lib/nitro/builders/xhtml.rb', line 98

def target
  @target
end

Instance Method Details

#<<(str) ⇒ Object



104
105
106
# File 'lib/nitro/builders/xhtml.rb', line 104

def << (str)
	@target << str
end

#to_sObject



108
109
110
# File 'lib/nitro/builders/xhtml.rb', line 108

def to_s
	@target.to_s
end