Sha256: 65d7d8decc1f596f35dcbdeaf7af9e867b6dc9b6df9174dc72a1fb8279a43a52

Contents?: true

Size: 596 Bytes

Versions: 10

Compression:

Stored size: 596 Bytes

Contents

require 'document_mapper'

module Sinatra
  module HacketySling
    class Post
      include DocumentMapper::Document

      self.directory = File.expand_path('../../../../test/test_posts', __FILE__)

      def permalink
        [
          self.date_permalink,
          self.file_name_without_extension.sub(/^\d{4}-\d{2}-\d{2}-/, '')
        ].join('') + '/'
      end

      def date_permalink
        '/' + ([
          sprintf("%04d", self.date.year),
          sprintf("%02d", self.date.month),
          sprintf("%02d", self.date.day)
        ].join '/') + '/'
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
hackety_sling-0.1.3 lib/sinatra/hackety_sling/post.rb
hackety_sling-0.1.2 lib/sinatra/hackety_sling/post.rb
hackety_sling-0.1.1 lib/sinatra/hackety_sling/post.rb
hackety_sling-0.1.0 lib/sinatra/hackety_sling/post.rb
hackety_sling-0.0.6 lib/sinatra/hackety_sling/post.rb
hackety_sling-0.0.5 lib/sinatra/hackety_sling/post.rb
hackety_sling-0.0.4 lib/sinatra/hackety_sling/post.rb
hackety_sling-0.0.3 lib/sinatra/hackety_sling/post.rb
hackety_sling-0.0.2 lib/sinatra/hackety_sling/post.rb
hackety_sling-0.0.1 lib/sinatra/hackety_sling/post.rb