Method: Doculab::Doc.find

Defined in:
app/models/doculab/doc.rb

.find(permalink) ⇒ Object



22
23
24
25
26
27
28
29
30
31
# File 'app/models/doculab/doc.rb', line 22

def self.find(permalink)
  file = file_for_permalink(permalink)

  unless file && File.exist?(file)
    raise FileNotFound, "No file found for '#{permalink}'"
  end

  content = File.read(file)
  self.new(:permalink => permalink, :file => file, :content => content)
end