Class: Bgem::Write
- Inherits:
-
Object
- Object
- Bgem::Write
- Defined in:
- lib/bgem.rb
Instance Attribute Summary collapse
-
#file ⇒ Object
readonly
Returns the value of attribute file.
Instance Method Summary collapse
- #[](string) ⇒ Object
-
#initialize(config) ⇒ Write
constructor
A new instance of Write.
Constructor Details
#initialize(config) ⇒ Write
Returns a new instance of Write.
315 316 317 318 |
# File 'lib/bgem.rb', line 315 def initialize config @file = Pathname config.output @scope = config.scope end |
Instance Attribute Details
#file ⇒ Object (readonly)
Returns the value of attribute file.
320 321 322 |
# File 'lib/bgem.rb', line 320 def file @file end |
Instance Method Details
#[](string) ⇒ Object
322 323 324 325 326 327 328 329 330 331 332 |
# File 'lib/bgem.rb', line 322 def [] string file.dirname.mkpath if @scope @scope.each do |header| string = "#{header}\n#{string.indent INDENT}\nend" end end file.write "#{string}\n" end |