Class: Hoe::ManualGen::PageFilter

Inherits:
Object
  • Object
show all
Includes:
Logging, Singleton
Defined in:
lib/hoe/manualgen.rb

Overview

An abstract filter class for manual content transformation.

Direct Known Subclasses

ErbFilter, TextileFilter

Class Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Class Attribute Details

.derivativesObject (readonly)

Returns the value of attribute derivatives.



486
487
488
# File 'lib/hoe/manualgen.rb', line 486

def derivatives
  @derivatives
end

Class Method Details

.inherited(subclass) ⇒ Object

Inheritance callback – keep track of all inheriting classes for later.



490
491
492
493
494
495
496
497
498
499
500
501
# File 'lib/hoe/manualgen.rb', line 490

def self::inherited( subclass )
	key = subclass.name.
		sub( /^.*::/, '' ).
		gsub( /[^[:alpha:]]+/, '_' ).
		downcase.
		sub( /filter$/, '' )

	self.derivatives[ key ] = subclass
	self.derivatives[ key.to_sym ] = subclass

	super
end

Instance Method Details

#export_resources(output_dir) ⇒ Object

Export any static resources required by this filter to the given output_dir.



505
506
507
# File 'lib/hoe/manualgen.rb', line 505

def export_resources( output_dir )
	# No-op by default
end

#process(source, page, metadata) ⇒ Object

Process the page‘s source with the filter and return the altered content.

Raises:

  • (NotImplementedError)


511
512
513
514
# File 'lib/hoe/manualgen.rb', line 511

def process( source, page,  )
	raise NotImplementedError,
		"%s does not implement the #process method" % [ self.class.name ]
end