Permalink
Browse files

Adding a titles method to return all titles

I'm not sure this is useful, but it at least lets me get my
infrastructure going.
  • Loading branch information...
1 parent 09012a9 commit efede7f1642c23b5e4c09ab5f5ebb072a692f7ba @steveklabnik steveklabnik committed Jan 25, 2012
View
@@ -1,3 +1,6 @@
+---
+title: "Data Types"
+---
# Data Types
## This is where it starts getting fun!
View
@@ -1,3 +1,7 @@
+---
+title: "Data Structures"
+---
+
# Beginner Data Structures
## Hello there!
View
@@ -1,3 +1,7 @@
+---
+title: "Programming"
+---
+
# Beginner Programming
## Hello there!
View
@@ -1,3 +1,7 @@
+---
+title: "Ruby"
+---
+
# Beginner Ruby
## Hello there!
View
@@ -1,3 +1,7 @@
+---
+title: "Shoes"
+---
+
# Beginner Shoes
## Hello there!
View
@@ -1,3 +1,7 @@
+---
+title: "Tour"
+---
+
# A Tour of Hackety Hack
## Welcome!
@@ -14,4 +14,6 @@ Gem::Specification.new do |gem|
gem.name = "hackety_hack-lessons"
gem.require_paths = ["lib"]
gem.version = HacketyHack::Lessons::VERSION
+
+ gem.add_runtime_dependency "metadown"
end
@@ -1,8 +1,15 @@
-require "hackety_hack/lessons/version"
-
-puts "Nothing to see here yet..."
+require 'hackety_hack/lessons/version'
+require 'metadown'
module HacketyHack
module Lessons
+ extend self
+
+ FILE_LIST = Dir["content/*.md"]
+
+ def titles
+ FILE_LIST.collect{|file| Metadown.render(File.read(file)) }.
+ collect{|data| data.metadata["title"]}
+ end
end
end

0 comments on commit efede7f

Please sign in to comment.