Class: RicherText::TextVisitor

Inherits:
Object
  • Object
show all
Defined in:
lib/richer_text/text_visitor.rb

Instance Method Summary collapse

Instance Method Details

#visit(node) ⇒ Object



3
4
5
# File 'lib/richer_text/text_visitor.rb', line 3

def visit(node)
  node.accept(self)
end

#visit_attachment_figure(node) ⇒ Object



7
8
9
# File 'lib/richer_text/text_visitor.rb', line 7

def visit_attachment_figure(node)
  visit_children(node)
end


11
12
13
# File 'lib/richer_text/text_visitor.rb', line 11

def visit_attachment_gallery(node)
  visit_children(node)
end

#visit_blockquote(node) ⇒ Object



15
16
17
# File 'lib/richer_text/text_visitor.rb', line 15

def visit_blockquote(node)
  visit_children(node)
end

#visit_bullet_list(node) ⇒ Object



19
20
21
# File 'lib/richer_text/text_visitor.rb', line 19

def visit_bullet_list(node)
  visit_children(node)
end

#visit_callout(node) ⇒ Object



23
24
25
# File 'lib/richer_text/text_visitor.rb', line 23

def visit_callout(node)
  visit_children(node)
end

#visit_children(node) ⇒ Object



27
28
29
# File 'lib/richer_text/text_visitor.rb', line 27

def visit_children(node)
  node.children.map { |child| visit(child) }.join(" ")
end

#visit_code_block(node) ⇒ Object



31
32
# File 'lib/richer_text/text_visitor.rb', line 31

def visit_code_block(node)
end

#visit_doc(node) ⇒ Object



34
35
36
# File 'lib/richer_text/text_visitor.rb', line 34

def visit_doc(node)
  visit_children(node)
end

#visit_hard_break(_node) ⇒ Object



64
65
# File 'lib/richer_text/text_visitor.rb', line 64

def visit_hard_break(_node)
end

#visit_heading(node) ⇒ Object



60
61
62
# File 'lib/richer_text/text_visitor.rb', line 60

def visit_heading(node)
  visit_children(node)
end

#visit_horizontal_rule(_node) ⇒ Object



67
68
# File 'lib/richer_text/text_visitor.rb', line 67

def visit_horizontal_rule(_node)
end

#visit_iframely_embed(node) ⇒ Object



38
39
# File 'lib/richer_text/text_visitor.rb', line 38

def visit_iframely_embed(node)
end

#visit_image(_node) ⇒ Object



70
71
# File 'lib/richer_text/text_visitor.rb', line 70

def visit_image(_node)
end

#visit_list_item(node) ⇒ Object



52
53
54
# File 'lib/richer_text/text_visitor.rb', line 52

def visit_list_item(node)
  visit_children(node)
end

#visit_mention(node, _marks) ⇒ Object



41
42
43
# File 'lib/richer_text/text_visitor.rb', line 41

def visit_mention(node, _marks)
  node.name
end

#visit_ordered_list(node) ⇒ Object



56
57
58
# File 'lib/richer_text/text_visitor.rb', line 56

def visit_ordered_list(node)
  visit_children(node)
end

#visit_paragraph(node) ⇒ Object



45
46
47
# File 'lib/richer_text/text_visitor.rb', line 45

def visit_paragraph(node)
  visit_children(node)
end

#visit_richer_text_embed(node) ⇒ Object



49
50
# File 'lib/richer_text/text_visitor.rb', line 49

def visit_richer_text_embed(node)
end

#visit_table(node) ⇒ Object



77
78
79
# File 'lib/richer_text/text_visitor.rb', line 77

def visit_table(node)
  visit_children(node)
end

#visit_table_cell(node) ⇒ Object



85
86
87
# File 'lib/richer_text/text_visitor.rb', line 85

def visit_table_cell(node)
  visit_children(node)
end

#visit_table_header(node) ⇒ Object



89
90
91
# File 'lib/richer_text/text_visitor.rb', line 89

def visit_table_header(node)
  visit_children(node)
end

#visit_table_row(node) ⇒ Object



81
82
83
# File 'lib/richer_text/text_visitor.rb', line 81

def visit_table_row(node)
  visit_children(node)
end

#visit_text(node, _marks) ⇒ Object



73
74
75
# File 'lib/richer_text/text_visitor.rb', line 73

def visit_text(node, _marks)
  node.text
end