Class: Pieces::RouteCompiler
- Inherits:
-
Object
- Object
- Pieces::RouteCompiler
- Defined in:
- lib/pieces/compilers/route_compiler.rb
Instance Attribute Summary collapse
-
#globals ⇒ Object
readonly
Returns the value of attribute globals.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
Instance Method Summary collapse
- #compile(files, name, route) ⇒ Object
-
#initialize(config) ⇒ RouteCompiler
constructor
A new instance of RouteCompiler.
Constructor Details
#initialize(config) ⇒ RouteCompiler
Returns a new instance of RouteCompiler.
6 7 8 9 |
# File 'lib/pieces/compilers/route_compiler.rb', line 6 def initialize(config) @path = config[:path] || Dir.pwd @globals = config[:globals] || {} end |
Instance Attribute Details
#globals ⇒ Object (readonly)
Returns the value of attribute globals.
4 5 6 |
# File 'lib/pieces/compilers/route_compiler.rb', line 4 def globals @globals end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
3 4 5 |
# File 'lib/pieces/compilers/route_compiler.rb', line 3 def path @path end |
Instance Method Details
#compile(files, name, route) ⇒ Object
11 12 13 |
# File 'lib/pieces/compilers/route_compiler.rb', line 11 def compile(files, name, route) files.merge("#{name}.html" => { contents: yield_pieces(route), type: 'html' }) end |