Class: Jekyll::Thing

Inherits:
Item
  • Object
show all
Defined in:
lib/jekyll/thing.rb

Constant Summary

Constants inherited from Item

Item::MATCHER

Instance Attribute Summary

Attributes inherited from Item

#categories, #content, #data, #date, #ext, #output, #published, #site, #slug, #tags

Instance Method Summary collapse

Methods inherited from Item

#<=>, #add_top_level_dir, #dir, #id, #inspect, #permalink, #process, #related_items, #render, #template, #to_liquid, #url, valid?, #write

Methods included from Convertible

#content_type, #do_layout, #read_yaml, #to_s, #transform

Constructor Details

#initialize(site, source, dir, name) ⇒ Thing

Returns a new instance of Thing.



3
4
5
6
7
# File 'lib/jekyll/thing.rb', line 3

def initialize(site, source, dir, name)
  @kind = 'thing'
  @under_scored_dir = '_things'
  super
end

Instance Method Details

#nextObject



9
10
11
12
13
14
15
16
17
# File 'lib/jekyll/thing.rb', line 9

def next
  pos = self.site.things.index(self)

  if pos && pos < self.site.things.length-1
    self.site.things[pos+1]
  else
    nil
  end
end

#previousObject



19
20
21
22
23
24
25
26
# File 'lib/jekyll/thing.rb', line 19

def previous
  pos = self.site.things.index(self)
  if pos && pos > 0
    self.site.things[pos-1]
  else
    nil
  end
end