Class: MarkdownMetrics::Elements::Block::List
Instance Attribute Summary
#skip_lines_until
Class Method Summary
collapse
Instance Method Summary
collapse
#initialize
Class Method Details
.match_element(line, next_line) ⇒ Object
7
8
9
|
# File 'lib/markdown_metrics/elements/block/list.rb', line 7
def self.match_element(line, next_line)
line.to_s.match(/^\- .*/) || line.to_s.match(/^\d+. .*/) || line.to_s.match(/^\* .*/)
end
|
Instance Method Details
#attributes ⇒ Object
39
40
41
|
# File 'lib/markdown_metrics/elements/block/list.rb', line 39
def attributes
{ type: list_type }
end
|
#name ⇒ Object
11
12
13
|
# File 'lib/markdown_metrics/elements/block/list.rb', line 11
def name
:list
end
|
#value ⇒ Object
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
# File 'lib/markdown_metrics/elements/block/list.rb', line 15
def value
end_line = nil
next_line = @start_at
@lines[(@start_at + 1)..-1].each do |code_line|
next_line += 1
unless code_line.match(value_regex)
end_line = next_line - 1
break
end
end_line = @lines.size - 1 if end_line.nil?
end
if !end_line.nil?
@skip_lines_until = end_line
if list_type == :number
@lines[@start_at..end_line].map { |e| e[2..-1] }
else
@lines[@start_at..end_line].map { |e| e[1..-1] }
end
end
end
|