Class: Sinatra::HacketySling::Post

Inherits:
Object
  • Object
show all
Includes:
DocumentMapper::Document
Defined in:
lib/sinatra/hackety_sling/post.rb

Instance Method Summary collapse

Instance Method Details



17
18
19
20
21
22
23
# File 'lib/sinatra/hackety_sling/post.rb', line 17

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


10
11
12
13
14
15
# File 'lib/sinatra/hackety_sling/post.rb', line 10

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