Sha256: c2bda7784822cb69388e0a6cc6fef12eff7ede42865691ada7c5fb4e3b4231d9

Contents?: true

Size: 603 Bytes

Versions: 1

Compression:

Stored size: 603 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 slugs
      all.collect{|data| data.metadata["slug"]}
    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.3 lib/hackety_hack/lessons.rb