Class: N::Shader
Overview
A shader defines a transformation-pipeline that tansforms the .xhtml files to actual ruby code ready for evaluation (compilation) by the engine.
Shaders are equivalend to the render-pipeline filters, ie they share their folded-filter design. – TODO: pipeline stage mixin to be reused in filters too. ++
Direct Known Subclasses
Instance Attribute Summary collapse
-
#next_stage ⇒ Object
readonly
the next stage in the Shader pipeline.
Instance Method Summary collapse
-
#<<(next_stage = nil) ⇒ Object
Set the next stage of the pipeline.
-
#initialize(next_stage = nil) ⇒ Shader
constructor
A new instance of Shader.
-
#process(hash, text) ⇒ Object
Process the text and optionally update the hash.
-
#process_next(hash, text) ⇒ Object
Process the next stage of the pipeline.
Constructor Details
#initialize(next_stage = nil) ⇒ Shader
Returns a new instance of Shader.
25 26 27 |
# File 'lib/nitro/shaders.rb', line 25 def initialize(next_stage = nil) @next_stage = next_stage end |
Instance Attribute Details
#next_stage ⇒ Object (readonly)
the next stage in the Shader pipeline.
23 24 25 |
# File 'lib/nitro/shaders.rb', line 23 def next_stage @next_stage end |
Instance Method Details
#<<(next_stage = nil) ⇒ Object
Set the next stage of the pipeline.
39 40 41 42 |
# File 'lib/nitro/shaders.rb', line 39 def << (next_stage = nil) @next_stage = next_stage return self end |
#process(hash, text) ⇒ Object
Process the text and optionally update the hash. The hash is a short, unique representation of the input text, typically used as a caching key.
33 34 35 |
# File 'lib/nitro/shaders.rb', line 33 def process(hash, text) process_next(hash, text) end |
#process_next(hash, text) ⇒ Object
Process the next stage of the pipeline.
46 47 48 49 50 51 52 |
# File 'lib/nitro/shaders.rb', line 46 def process_next(hash, text) if @next_stage return @next_stage.process(hash, text) else return hash, text end end |