Class: Hoe::ManualGen::PageFilter
- Inherits:
-
Object
- Object
- Hoe::ManualGen::PageFilter
- Includes:
- Singleton
- Defined in:
- lib/hoe/manualgen.rb
Overview
An abstract filter class for manual content transformation.
Direct Known Subclasses
Class Attribute Summary collapse
-
.derivatives ⇒ Object
readonly
Returns the value of attribute derivatives.
Class Method Summary collapse
-
.inherited(subclass) ⇒ Object
Inheritance callback – keep track of all inheriting classes for later.
Instance Method Summary collapse
-
#export_resources(output_dir) ⇒ Object
Export any static resources required by this filter to the given
output_dir
. -
#process(source, page, metadata) ⇒ Object
Process the
page
‘s source with the filter and return the altered content.
Class Attribute Details
.derivatives ⇒ Object (readonly)
Returns the value of attribute derivatives.
470 471 472 |
# File 'lib/hoe/manualgen.rb', line 470 def derivatives @derivatives end |
Class Method Details
.inherited(subclass) ⇒ Object
Inheritance callback – keep track of all inheriting classes for later.
474 475 476 477 478 479 480 481 482 483 484 485 |
# File 'lib/hoe/manualgen.rb', line 474 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
.
489 490 491 |
# File 'lib/hoe/manualgen.rb', line 489 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.
495 496 497 498 |
# File 'lib/hoe/manualgen.rb', line 495 def process( source, page, ) raise NotImplementedError, "%s does not implement the #process method" % [ self.class.name ] end |