Class: Gn::Blueprint

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

Instance Method Summary collapse

Constructor Details

#initialize(parent, constant) ⇒ Blueprint

Returns a new instance of Blueprint.



6
7
8
9
10
# File 'lib/gn.rb', line 6

def initialize(parent, constant)
  @parent   = parent
  @instance = constant.new
  @name     = constant.name
end

Instance Method Details

#destinationObject



12
13
14
# File 'lib/gn.rb', line 12

def destination
  @instance.destination
end

#fileObject



16
17
18
# File 'lib/gn.rb', line 16

def file
  File.join(@name.downcase.split("::")) + ".mote"
end

#renderObject



24
25
26
# File 'lib/gn.rb', line 24

def render
  Mote.parse(template, @instance).call
end

#templateObject



20
21
22
# File 'lib/gn.rb', line 20

def template
  File.read(@parent.path(file))
end