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.
108 109 110 111 |
# File 'lib/bgem.rb', line 108 def initialize path = 'output.rb', scope @path = Pathname path @scope = scope end |
Instance Method Details
#file ⇒ Object
125 126 127 |
# File 'lib/bgem.rb', line 125 def file @path end |
#write(string) ⇒ Object
113 114 115 116 117 118 119 120 121 122 123 |
# File 'lib/bgem.rb', line 113 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 |