Method: RuneBlog#post_lookup

Defined in:
lib/runeblog.rb

#post_lookup(postid) ⇒ Object

side-effect?



413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
# File 'lib/runeblog.rb', line 413

def post_lookup(postid)    # side-effect?
  log!(enter: __method__, args: [postid], level: 2)
  slug = title = date = teaser_text = nil

  dir_posts = @vdir/:posts
  posts = Dir.entries(dir_posts).grep(/^\d\d\d\d/).map {|x| dir_posts/x }
  posts.select! {|x| File.directory?(x) }

  posts = posts.select {|x| File.basename(x).to_i == postid }
  postdir = exactly_one(posts, posts.join("/"))
  vp = RuneBlog::ViewPost.new(self.view, postdir)
  vp
rescue => err
  _tmp_error(err)
end