Class: Html2Bbcode::Html::Element

Inherits:
Object
  • Object
show all
Extended by:
Forwardable, Attributes
Defined in:
lib/html/element.rb

Instance Method Summary collapse

Methods included from Attributes

has_html_attributes

Constructor Details

#initialize(element, options = {}) ⇒ Element

Returns a new instance of Element.



9
10
11
12
# File 'lib/html/element.rb', line 9

def initialize element, options = {}
  @element = element
  @options = options
end

Instance Method Details

#font_sizeObject



30
31
32
# File 'lib/html/element.rb', line 30

def font_size
  get_size.to_i if get_font_size
end

#processObject



14
15
16
17
18
# File 'lib/html/element.rb', line 14

def process
  add_src_to_text if name.eql? 'img'

  children.map(&:to_bbcode_element).join
end

#to_bbcode_elementObject



20
21
22
23
24
25
26
27
28
# File 'lib/html/element.rb', line 20

def to_bbcode_element
  if name == 'br'
    "\n"
  elsif element?
    build_bbcode_element
  elsif text?
    text
  end
end