Sha256: 4315419af6c721b469cedbcef6c77a1238d33f88b22754d9119724283836a179
Contents?: true
Size: 1.03 KB
Versions: 3
Compression:
Stored size: 1.03 KB
Contents
module Middleman module Blog module Drafts module DraftArticle # The "slug" of the draft article that shows up in its URL. # @return [String] def slug @_slug ||= path_part("title") end # Retrieve a section of the source path # @param [String] The part of the path, e.g. "title" # @return [String] def path_part(part) @_path_parts ||= app.blog.drafts.path_matcher.match(path).captures @_path_parts[app.blog.drafts.matcher_indexes[part]] end # Returns current date as we can't guess when the article will be published # # We need this in place or the layout used for blog posts might blow up # # @return [TimeWithZone] def date Time.now.in_time_zone end # Extends resource data adding the date field # # @return [Thor::CoreExt::HashWithIndifferentAccess] def data super.dup.merge(date: date) end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems