Class: Potion::Post

Inherits:
Renderable show all
Defined in:
lib/potion/post.rb

Instance Attribute Summary collapse

Attributes inherited from Renderable

#content, #layout, #metadata, #output_path, #path, #relative_output_path, #site

Instance Method Summary collapse

Methods inherited from Renderable

#==, #is_html?, #load_content_and_metadata, #render, #title

Methods included from Helpers

#category, #link_to, #photo

Constructor Details

#initialize(path, site) ⇒ Post

Returns a new instance of Post.



5
6
7
8
9
10
11
# File 'lib/potion/post.rb', line 5

def initialize(path, site)
  @static_files = Dir[File.dirname(path) + "/*.*"].reject {|x| x == path}.map {|x| Potion::StaticFile.new(x, site)}
                  
  @relative_output_path = path.gsub("_posts/", "")
                          
  super(path, site)
end

Instance Attribute Details

#static_filesObject

Returns the value of attribute static_files.



3
4
5
# File 'lib/potion/post.rb', line 3

def static_files
  @static_files
end

Instance Method Details

#writeObject



13
14
15
16
# File 'lib/potion/post.rb', line 13

def write
  @static_files.each {|file| file.write }
  super
end