Class: Bgem::TargetFile
- Inherits:
-
Object
- Object
- Bgem::TargetFile
- Defined in:
- lib/bgem.rb
Instance Method Summary collapse
- #file ⇒ Object
-
#initialize(path = 'output.rb', scope) ⇒ TargetFile
constructor
A new instance of TargetFile.
- #write(string) ⇒ Object
Constructor Details
#initialize(path = 'output.rb', scope) ⇒ TargetFile
Returns a new instance of TargetFile.
100 101 102 103 |
# File 'lib/bgem.rb', line 100 def initialize path = 'output.rb', scope @path = Pathname path @scope = scope end |
Instance Method Details
#file ⇒ Object
117 118 119 |
# File 'lib/bgem.rb', line 117 def file @path end |
#write(string) ⇒ Object
105 106 107 108 109 110 111 112 113 114 115 |
# File 'lib/bgem.rb', line 105 def write string @path.dirname.mkpath if @scope @scope.each do |header| string = "#{header}\n#{string.indent INDENT}\nend" end end @path.write "#{string}\n" end |