Method: Moft::Post#initialize
- Defined in:
- lib/moft/post.rb
#initialize(site, source, dir, name) ⇒ Post
Initialize this Post instance.
site - The Site. base - The String path to the dir containing the post file. name - The String filename of the post file.
Returns the new Post.
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 |
# File 'lib/moft/post.rb', line 49 def initialize(site, source, dir, name) @site = site @dir = dir @base = self.containing_dir(source, dir) @name = name self.categories = dir.downcase.split('/').reject { |x| x.empty? } self.process(name) self.read_yaml(@base, name) if self.data.has_key?('date') self.date = Time.parse(self.data["date"].to_s) end self.published = self.published? self.populate_categories self. end |