Class: Stratus::Resources::Content

Inherits:
Base
  • Object
show all
Defined in:
lib/stratus/resources/content.rb

Instance Attribute Summary

Attributes inherited from Base

#collection_type, #content_path, #content_type, #index, #slug, #source_path

Instance Method Summary collapse

Methods inherited from Base

#<=>, #[], #[]=, #attachments, #attachments_hash, #fixup_meta, #initialize, #is_homepage, #metadata, #method_missing, #next_content, #output_path, #prev_content, #to_liquid

Constructor Details

This class inherits a constructor from Stratus::Resources::Base

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Stratus::Resources::Base

Instance Method Details

#full_pathObject



12
13
14
15
# File 'lib/stratus/resources/content.rb', line 12

def full_path
  parent_path = super
  super.empty? ? "index.html" : "#{parent_path}/index.html"
end

#validate!Object

Raises:

  • (StandardError)


5
6
7
8
9
10
# File 'lib/stratus/resources/content.rb', line 5

def validate!
  raise StandardError.new("Posts must have a publish-date! #{content_path}") if (!.has_key?(:publish_date) and collection_type == 'posts')
#    pp self
  # return false if it's future dated...
  [([:publish_date] < Time.now), "Publish date is in the future..."]
end