Sha256: 54bb55fa41f43caab6bdb9771e445bd8f58512b22aa09c7c6ac9706fa990e03f

Contents?: true

Size: 532 Bytes

Versions: 1

Compression:

Stored size: 532 Bytes

Contents

require 'hackety_hack/lessons/version'
require 'metadown'

module HacketyHack
  module Lessons
    extend self

    FILE_LIST = Dir["#{File.dirname(__FILE__)}/../../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 find_by_slug(slug)
      all.find{|data| data.metadata["slug"] == slug}
    end

    def all
      FILE_LIST.collect{|file| Metadown.render(File.read(file)) }
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
hackety_hack-lessons-1.0.2 lib/hackety_hack/lessons.rb