Class: HTMLDocument
- Inherits:
-
Object
- Object
- HTMLDocument
- Defined in:
- lib/rbhtml.rb
Instance Method Summary collapse
- #create_element(tag, inner) ⇒ Object
-
#initialize ⇒ HTMLDocument
constructor
A new instance of HTMLDocument.
- #remove_char(char) ⇒ Object
- #remove_element(tag, inner) ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize ⇒ HTMLDocument
Returns a new instance of HTMLDocument.
13 14 15 16 17 |
# File 'lib/rbhtml.rb', line 13 def initialize @open_doc = "<html><body>" @close_doc = "</body></html>" @full_doc = @open_doc + @close_doc end |
Instance Method Details
#create_element(tag, inner) ⇒ Object
18 19 20 21 22 |
# File 'lib/rbhtml.rb', line 18 def create_element tag, inner @open_doc += "<#{tag}>#{inner}" @close_doc.strpush!("</#{tag}>") refresh_full end |
#remove_char(char) ⇒ Object
28 29 30 31 |
# File 'lib/rbhtml.rb', line 28 def remove_char char @open_doc.gsub!(">#{char}", ">") refresh_full end |
#remove_element(tag, inner) ⇒ Object
23 24 25 26 27 |
# File 'lib/rbhtml.rb', line 23 def remove_element tag, inner @open_doc.gsub!("<#{tag}>#{inner}", "") @close_doc.gsub!("</#{tag}>", "") refresh_full end |
#to_s ⇒ Object
32 33 34 |
# File 'lib/rbhtml.rb', line 32 def to_s @full_doc end |