Class: Ansei::Render
- Inherits:
-
Object
- Object
- Ansei::Render
- Defined in:
- lib/ansei/render.rb
Overview
Rendering class for Ansei
Instance Attribute Summary collapse
-
#info ⇒ Object
readonly
Returns the value of attribute info.
-
#original ⇒ Object
Returns the value of attribute original.
Instance Method Summary collapse
-
#compile ⇒ Object
Compile the objects content and write that to its destination.
-
#initialize(info) ⇒ Render
constructor
Initialize a new Render object.
Constructor Details
#initialize(info) ⇒ Render
Initialize a new Render object
info - FileInformation object
10 11 12 13 14 |
# File 'lib/ansei/render.rb', line 10 def initialize(info) @info = info @original = File.read(info.file) end |
Instance Attribute Details
#info ⇒ Object (readonly)
Returns the value of attribute info.
5 6 7 |
# File 'lib/ansei/render.rb', line 5 def info @info end |
#original ⇒ Object
Returns the value of attribute original.
4 5 6 |
# File 'lib/ansei/render.rb', line 4 def original @original end |
Instance Method Details
#compile ⇒ Object
Compile the objects content and write that to its destination
18 19 20 21 22 23 24 25 |
# File 'lib/ansei/render.rb', line 18 def compile Utils.cli_log(" create #{info.name}") type = info.type == :markdown ? info.type : :asset body = method(type).call Utils.file_write(info.destination, body) end |