Class: Rhb::Builder

Inherits:
Object
  • Object
show all
Defined in:
lib/rhb/builder.rb

Constant Summary collapse

VOID_ELEMENTS =
%w{area base br col command embed hr img input
keygen link meta param source track wbr}.freeze

Instance Method Summary collapse

Constructor Details

#initializeBuilder

Returns a new instance of Builder.



8
9
10
# File 'lib/rhb/builder.rb', line 8

def initialize
  @buffer = ''
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(name, *args, &block) ⇒ Object (private)



62
63
64
65
# File 'lib/rhb/builder.rb', line 62

def method_missing name, *args, &block
  cache_element name
  public_send name, *args, &block
end

Instance Method Details

#doctypeObject



17
18
19
# File 'lib/rhb/builder.rb', line 17

def doctype
  @buffer << '<!DOCTYPE html>'
end

#to_sObject Also known as: to_html



12
13
14
# File 'lib/rhb/builder.rb', line 12

def to_s
  @buffer
end