Class: Gumdrop::GeneratedContent

Inherits:
Content
  • Object
show all
Defined in:
lib/gumdrop/generator.rb

Instance Attribute Summary

Attributes inherited from Content

#ext, #filename, #full_path, #generated, #ignored, #level, #params, #path, #site, #slug, #source_filename, #template, #type, #uri

Instance Method Summary collapse

Methods inherited from Content

#copyTo, #ignore?, #mtime, #renderTo, #to_s

Constructor Details

#initialize(path, block, site, params = {}) ⇒ GeneratedContent

Nothing special, per se…



189
190
191
192
193
# File 'lib/gumdrop/generator.rb', line 189

def initialize(path, block, site, params={})
  super(path, site, params)
  @content_block= block
  @generated= true
end

Instance Method Details

#render(context = nil, ignore_layout = false, reset_context = true, locals = {}) ⇒ Object



195
196
197
198
199
200
201
# File 'lib/gumdrop/generator.rb', line 195

def render(context=nil, ignore_layout=false,  reset_context=true, locals={})
  if @content_block.nil?
    super(context, ignore_layout, reset_context, locals)
  else
    @content_block.call
  end
end

#useLayout?Boolean

Returns:

  • (Boolean)


203
204
205
# File 'lib/gumdrop/generator.rb', line 203

def useLayout?
  !@content_block.nil? or !@template.nil?
end