Class: Gap::GodErb

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

Instance Method Summary collapse

Constructor Details

#initialize(tmpl, app, part, commands) ⇒ GodErb

Returns a new instance of GodErb.



4
5
6
7
8
9
10
# File 'lib/gap/god_erb.rb', line 4

def initialize(tmpl,app,part,commands)
  @app = app
  @part = part
  @commands = commands
  view = File.open(tmpl)
  @erb = ERB.new(view.read)
end

Instance Method Details

#renderObject



12
13
14
15
16
17
18
19
20
21
# File 'lib/gap/god_erb.rb', line 12

def render
  # ファイル出力
  output = "./config/god_#{@app}_#{@part}.rb"
  txt = @erb.result(binding)
  fw = File.open(output, 'w')
  fw.puts(txt)
  fw.close

  output
end