Module: Lilliput

Defined in:
lib/lilliput.rb

Defined Under Namespace

Classes: Post

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.authorObject

Returns the value of attribute author.



7
8
9
# File 'lib/lilliput.rb', line 7

def author
  @author
end

.emailObject

Returns the value of attribute email.



7
8
9
# File 'lib/lilliput.rb', line 7

def email
  @email
end

.folderObject

Returns the value of attribute folder.



7
8
9
# File 'lib/lilliput.rb', line 7

def folder
  @folder
end

.show_unpublishedObject

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

.allObject



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

.firstObject



20
21
22
# File 'lib/lilliput.rb', line 20

def first
  all.first
end