lib/mr_poole/helper.rb
def get_layout(layout_path)

      if layout_path.nil?
        contents  = "---\n"
        contents << "title:\n"
        contents << "layout: post\n"
        contents << "date:\n"
        contents << "---\n"
        ext = nil
      else
        begin
          contents = File.open(layout_path, "r").read()
          ext = layout_path.match(/\.(.*?)$/)[1]
        rescue Errno::ENOENT
          bad_path(layout_path)
        end
      end

      return contents, ext
    end
def get_layout(layout_path)

      if layout_path.nil?
        contents  = "---\n"
        contents << "title:\n"
        contents << "layout: post\n"
        contents << "date:\n"
        contents << "---\n"
        ext = nil
      else
        begin
          contents = File.open(layout_path, "r").read()
          ext = layout_path.match(/\.(.*?)$/)[1]
        rescue Errno::ENOENT
          bad_path(layout_path)
        end
      end

      return contents, ext
    end
Get a layout as a string. If layout_path is non-nil,  will open that
 file and read it, otherwise will return a default one, and a file
 extension to use