Class: MarkdownMetrics::Elements::Inline::Image

Inherits:
Base
  • Object
show all
Defined in:
lib/markdown_metrics/elements/inline/image.rb

Instance Attribute Summary

Attributes inherited from Base

#skip_lines_until

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#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/inline/image.rb', line 7

def self.match_element(line, next_line)
  line.to_s.match(/^\!\[.*\)$/)
end

Instance Method Details

#attributesObject



19
20
21
# File 'lib/markdown_metrics/elements/inline/image.rb', line 19

def attributes
  { alt: current_line.match(/\[(?<alt>.*)\]/)['alt'] }
end

#nameObject



11
12
13
# File 'lib/markdown_metrics/elements/inline/image.rb', line 11

def name
  :image
end

#valueObject



15
16
17
# File 'lib/markdown_metrics/elements/inline/image.rb', line 15

def value
  current_line.match(/\((?<image>.*)\)$/)['image']
end