Class: Gn::Blueprint
- Inherits:
-
Object
- Object
- Gn::Blueprint
- Defined in:
- lib/gn.rb
Instance Method Summary collapse
- #destination ⇒ Object
- #file ⇒ Object
-
#initialize(parent, constant) ⇒ Blueprint
constructor
A new instance of Blueprint.
- #render ⇒ Object
- #template ⇒ Object
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
#destination ⇒ Object
12 13 14 |
# File 'lib/gn.rb', line 12 def destination @instance.destination end |
#file ⇒ Object
16 17 18 |
# File 'lib/gn.rb', line 16 def file File.join(@name.downcase.split("::")) + ".mote" end |
#render ⇒ Object
24 25 26 |
# File 'lib/gn.rb', line 24 def render Mote.parse(template, @instance).call end |
#template ⇒ Object
20 21 22 |
# File 'lib/gn.rb', line 20 def template File.read(@parent.path(file)) end |