Class: Ansei::Render

Inherits:
Object
  • Object
show all
Defined in:
lib/ansei/render.rb

Overview

Rendering class for Ansei

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#infoObject (readonly)

Returns the value of attribute info.



5
6
7
# File 'lib/ansei/render.rb', line 5

def info
  @info
end

#originalObject

Returns the value of attribute original.



4
5
6
# File 'lib/ansei/render.rb', line 4

def original
  @original
end

Instance Method Details

#compileObject

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