Class: BridgetownNotion::Parsers::SlugParser

Inherits:
Object
  • Object
show all
Defined in:
lib/bridgetown_notion/parsers/slug_parser.rb

Class Method Summary collapse

Class Method Details

.parse(post) ⇒ Object



6
7
8
9
10
# File 'lib/bridgetown_notion/parsers/slug_parser.rb', line 6

def self.parse(post)
  published_at = BridgetownNotion::Parsers::PublishedAtParser.parse(post)
  title = BridgetownNotion::Parsers::TitleParser.parse(post)
  "#{published_at}-#{title}".downcase.strip.tr(" ", "-").gsub(%r/[^\w-]/, "")
end