Skip to content

Commit efede7f

Browse files
committed
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.
1 parent 09012a9 commit efede7f

File tree

8 files changed

+35
-3
lines changed

8 files changed

+35
-3
lines changed

Diff for: content/data_types.md

+3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
---
2+
title: "Data Types"
3+
---
14
# Data Types
25

36
## This is where it starts getting fun!

Diff for: content/datastrucs.md

+4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
---
2+
title: "Data Structures"
3+
---
4+
15
# Beginner Data Structures
26

37
## Hello there!

Diff for: content/programming.md

+4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
---
2+
title: "Programming"
3+
---
4+
15
# Beginner Programming
26

37
## Hello there!

Diff for: content/ruby.md

+4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
---
2+
title: "Ruby"
3+
---
4+
15
# Beginner Ruby
26

37
## Hello there!

Diff for: content/shoes.md

+4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
---
2+
title: "Shoes"
3+
---
4+
15
# Beginner Shoes
26

37
## Hello there!

Diff for: content/tour.md

+4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
---
2+
title: "Tour"
3+
---
4+
15
# A Tour of Hackety Hack
26

37
## Welcome!

Diff for: hackety_hack-lessons.gemspec

+2
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,6 @@ Gem::Specification.new do |gem|
1414
gem.name = "hackety_hack-lessons"
1515
gem.require_paths = ["lib"]
1616
gem.version = HacketyHack::Lessons::VERSION
17+
18+
gem.add_runtime_dependency "metadown"
1719
end

Diff for: lib/hackety_hack/lessons.rb

+10-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,15 @@
1-
require "hackety_hack/lessons/version"
2-
3-
puts "Nothing to see here yet..."
1+
require 'hackety_hack/lessons/version'
2+
require 'metadown'
43

54
module HacketyHack
65
module Lessons
6+
extend self
7+
8+
FILE_LIST = Dir["content/*.md"]
9+
10+
def titles
11+
FILE_LIST.collect{|file| Metadown.render(File.read(file)) }.
12+
collect{|data| data.metadata["title"]}
13+
end
714
end
815
end

0 commit comments

Comments
 (0)