Class: Escapement::Element::Paragraph

Inherits:
Base
  • Object
show all
Defined in:
lib/escapement/elements/paragraph.rb

Instance Attribute Summary

Attributes inherited from Base

#node, #result

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#initialize

Methods included from PrettyNames

#node_to_type

Methods included from Traversal

#process_children

Constructor Details

This class inherits a constructor from Escapement::Element::Base

Class Method Details

.should_handle?(node) ⇒ Boolean

Returns:

  • (Boolean)


4
5
6
# File 'lib/escapement/elements/paragraph.rb', line 4

def self.should_handle?(node)
  ['p', 'li'].include? node.name
end

Instance Method Details

#process!Object



8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/escapement/elements/paragraph.rb', line 8

def process!
  return if node_is_blank?

  process_children

  @result = {
    type: node_to_type,
    html_tag: node.name,
    text: node.text,
    entities: @entities
  }
end