Class: Nokogiri::XML::Element

Inherits:
Object
  • Object
show all
Defined in:
lib/nokogiri/xml/element.rb

Constant Summary collapse

DEFAULT_FONT_SIZE =
12.to_f

Instance Method Summary collapse

Instance Method Details

#bold?Boolean

Returns:

  • (Boolean)


16
17
18
# File 'lib/nokogiri/xml/element.rb', line 16

def bold?
  styles['font-weight'] && styles['font-weight'] == 'bold'
end

#font_sizeObject

The node’s font size Used for guessing heading sizes

Returns a float with the font-size



12
13
14
# File 'lib/nokogiri/xml/element.rb', line 12

def font_size
  styles['font-size'] ? styles['font-size'].to_f : DEFAULT_FONT_SIZE
end

#italic?Boolean

Returns:

  • (Boolean)


20
21
22
# File 'lib/nokogiri/xml/element.rb', line 20

def italic?
  styles['font-style'] && styles['font-style'] == 'italic'
end