Module: Lilliput
- Defined in:
- lib/lilliput.rb
Defined Under Namespace
Classes: Post
Class Attribute Summary collapse
-
.author ⇒ Object
Returns the value of attribute author.
-
.email ⇒ Object
Returns the value of attribute email.
-
.folder ⇒ Object
Returns the value of attribute folder.
-
.show_unpublished ⇒ Object
Returns the value of attribute show_unpublished.
Class Method Summary collapse
Class Attribute Details
.author ⇒ Object
Returns the value of attribute author.
7 8 9 |
# File 'lib/lilliput.rb', line 7 def @author end |
.email ⇒ Object
Returns the value of attribute email.
7 8 9 |
# File 'lib/lilliput.rb', line 7 def email @email end |
.folder ⇒ Object
Returns the value of attribute folder.
7 8 9 |
# File 'lib/lilliput.rb', line 7 def folder @folder end |
.show_unpublished ⇒ Object
Returns the value of attribute show_unpublished.
7 8 9 |
# File 'lib/lilliput.rb', line 7 def show_unpublished @show_unpublished end |
Class Method Details
.all ⇒ Object
9 10 11 12 13 14 |
# File 'lib/lilliput.rb', line 9 def all files = Dir.glob(File.join(folder, '*')).reverse posts = files.map { |f| Post.new(f) } posts = posts.select { |p| p.published? } unless Lilliput.show_unpublished posts end |
.find(slug) ⇒ Object
16 17 18 |
# File 'lib/lilliput.rb', line 16 def find(slug) all.select{ |p| p.slug == slug }.first end |
.first ⇒ Object
20 21 22 |
# File 'lib/lilliput.rb', line 20 def first all.first end |