Class: Yass::LiquidTemplate::SourceDrop

Inherits:
Liquid::Drop
  • Object
show all
Defined in:
lib/yass/liquid_template.rb

Instance Method Summary collapse

Constructor Details

#initialize(source) ⇒ SourceDrop

Returns a new instance of SourceDrop.



38
# File 'lib/yass/liquid_template.rb', line 38

def initialize(source) = @source = source

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(attr) ⇒ Object



60
# File 'lib/yass/liquid_template.rb', line 60

def method_missing(attr) = @source.front_matter[attr.to_s]

Instance Method Details

#contentObject



58
# File 'lib/yass/liquid_template.rb', line 58

def content = Renderer.new(@source).render(layout: false)

#dirnameObject



48
# File 'lib/yass/liquid_template.rb', line 48

def dirname = @source.dest_path.dirname.to_s

#extnameObject



52
# File 'lib/yass/liquid_template.rb', line 52

def extname = @source.dest_path.extname.to_s

#filenameObject



50
# File 'lib/yass/liquid_template.rb', line 50

def filename = @source.dest_path.basename.to_s

#filesizeObject



54
# File 'lib/yass/liquid_template.rb', line 54

def filesize = @source.size

#layoutObject



42
# File 'lib/yass/liquid_template.rb', line 42

def layout = @source.layout&.name

#pathObject



44
# File 'lib/yass/liquid_template.rb', line 44

def path = @source.dest_path.to_s

#publishedObject



56
# File 'lib/yass/liquid_template.rb', line 56

def published = @source.published?

#src_pathObject



46
# File 'lib/yass/liquid_template.rb', line 46

def src_path = @source.src_path.to_s

#titleObject



40
# File 'lib/yass/liquid_template.rb', line 40

def title = @source.title