Class: Stratus::Resources::Template

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

Direct Known Subclasses

Layout

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, #is_homepage, #metadata, #method_missing, #next_content, #output_path, #prev_content, #to_liquid

Constructor Details

#initialize(fullpath, content_path = '') ⇒ Template

Returns a new instance of Template.



5
6
7
8
# File 'lib/stratus/resources/template.rb', line 5

def initialize(fullpath, content_path='')
  super(fullpath, content_path, :template)
  @content_type = :template
end

Dynamic Method Handling

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

Instance Method Details

#full_pathObject



18
19
20
# File 'lib/stratus/resources/template.rb', line 18

def full_path
  content_path
end

#validate!Object



10
11
12
13
14
15
16
# File 'lib/stratus/resources/template.rb', line 10

def validate!
#    puts "SETTING LAYOUT TO 'main' for #{content_path}" unless metadata.has_key? :layout
  [:layout] = 'main' unless .has_key? :layout
  #raise StandardError.new("Posts must have a published-on date! #{content_path}") unless metadata.has_key?(:publish_on)
#    puts "LAYOUT = '#{metadata[:layout]}'" 
  true
end