lib/hackety_hack/lessons.rb in hackety_hack-lessons-0.0.1 vs lib/hackety_hack/lessons.rb in hackety_hack-lessons-1.0.0

- old
+ new

@@ -1,8 +1,22 @@ -require "hackety_hack/lessons/version" +require 'hackety_hack/lessons/version' +require 'metadown' -puts "Nothing to see here yet..." - module HacketyHack module Lessons + extend self + + FILE_LIST = Dir["content/*.md"] + + def titles + all.collect{|data| data.metadata["title"]} + end + + def find_by_title(title) + all.find{|data| data.metadata["title"] == title} + end + + def all + FILE_LIST.collect{|file| Metadown.render(File.read(file)) } + end end end