Class: Yuzu::Generators::Generator

Inherits:
Filter
  • Object
show all
Defined in:
lib/yuzu/generators/base.rb

Overview

Generators are like filters but they have the ability to produce new files and folders in the website tree.

Constant Summary collapse

@@generators =
{}

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeGenerator

Returns a new instance of Generator.



20
21
22
23
# File 'lib/yuzu/generators/base.rb', line 20

def initialize
  @name = :generator
  @directive = "GENERATOR"
end

Instance Attribute Details

#directiveObject (readonly)

Returns the value of attribute directive.



18
19
20
# File 'lib/yuzu/generators/base.rb', line 18

def directive
  @directive
end

#nameObject (readonly)

Returns the value of attribute name.



18
19
20
# File 'lib/yuzu/generators/base.rb', line 18

def name
  @name
end

Class Method Details

.generatorsObject



14
15
16
# File 'lib/yuzu/generators/base.rb', line 14

def self.generators
  @@generators
end

.registryObject



11
12
13
# File 'lib/yuzu/generators/base.rb', line 11

def self.registry
  :generators
end

Instance Method Details

#generate!(website_obj) ⇒ Object

generate!() is called on the first pass by a visitor in the siteroot.

Parameters:



36
37
38
# File 'lib/yuzu/generators/base.rb', line 36

def generate!(website_obj)
  # Produce new children and add them to the tree, if necessary.
end

#should_generate?(website_file) ⇒ Boolean

Returns:

  • (Boolean)


25
26
27
# File 'lib/yuzu/generators/base.rb', line 25

def should_generate?(website_file)
  false
end

#visitor_filterObject



29
30
31
# File 'lib/yuzu/generators/base.rb', line 29

def visitor_filter
  proc {|c| true}
end