Class: JekyllRPG::MarkdownLink
- Inherits:
-
Object
- Object
- JekyllRPG::MarkdownLink
- Defined in:
- lib/markdown_link.rb
Overview
A markdown link with components extracted from text [name](/collection/slug)
Instance Method Summary collapse
- #collection ⇒ Object
-
#initialize(link) ⇒ MarkdownLink
constructor
A new instance of MarkdownLink.
- #name ⇒ Object
- #slug ⇒ Object
Constructor Details
#initialize(link) ⇒ MarkdownLink
Returns a new instance of MarkdownLink.
7 8 9 |
# File 'lib/markdown_link.rb', line 7 def initialize(link) @link = link end |
Instance Method Details
#collection ⇒ Object
19 20 21 |
# File 'lib/markdown_link.rb', line 19 def collection @link[%r{(?<=/).*(?=/)}] end |
#name ⇒ Object
11 12 13 |
# File 'lib/markdown_link.rb', line 11 def name @link[/(?<=\[).*?(?=\])/] end |
#slug ⇒ Object
15 16 17 |
# File 'lib/markdown_link.rb', line 15 def slug @link[%r{(?<=/)(?:(?!/).)*?(?=\))}] end |