Module: Terror::Helper

Defined in:
lib/terror/helper.rb

Instance Method Summary collapse

Instance Method Details

#configObject



3
4
5
# File 'lib/terror/helper.rb', line 3

def config
  Terror.config
end

#each_postObject



7
8
9
10
11
12
# File 'lib/terror/helper.rb', line 7

def each_post
  @posts.each do |post|
    date = Date.parse(post.date.to_s)      
    yield(post, @current_date != date ? @current_date = date : nil)
  end
end

#newer_pageObject



22
23
24
# File 'lib/terror/helper.rb', line 22

def newer_page
  @posts.current_page - 1
end

#newer_page?Boolean

Returns:

  • (Boolean)


18
19
20
# File 'lib/terror/helper.rb', line 18

def newer_page?
  @posts.current_page > 1
end

#older_pageObject



30
31
32
# File 'lib/terror/helper.rb', line 30

def older_page
  @posts.current_page + 1
end

#older_page?Boolean

Returns:

  • (Boolean)


26
27
28
# File 'lib/terror/helper.rb', line 26

def older_page?
  @posts.total_pages > @posts.current_page
end

#rfc_3339(time) ⇒ Object



14
15
16
# File 'lib/terror/helper.rb', line 14

def rfc_3339(time)
  time.strftime("%Y-%m-%dT%H:%M:%SZ") if time
end