Class: MarkdownMetrics::Elements::Block::Quote

Inherits:
MarkdownMetrics::Elements::Base show all
Defined in:
lib/markdown_metrics/elements/block/quote.rb

Instance Attribute Summary

Attributes inherited from MarkdownMetrics::Elements::Base

#skip_lines_until

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from MarkdownMetrics::Elements::Base

#attributes, #initialize

Constructor Details

This class inherits a constructor from MarkdownMetrics::Elements::Base

Class Method Details

.match_element(line, next_line) ⇒ Object



7
8
9
# File 'lib/markdown_metrics/elements/block/quote.rb', line 7

def self.match_element(line, next_line)
  line.to_s.match(/^\>/)
end

Instance Method Details

#nameObject



11
12
13
# File 'lib/markdown_metrics/elements/block/quote.rb', line 11

def name
  :quote
end

#valueObject



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/markdown_metrics/elements/block/quote.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(/^\>/)
      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
    @lines[@start_at..end_line].map { |e| e[1..-1] }
  end
end