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.
163 164 165 166 |
# File 'lib/bgem.rb', line 163 def initialize config @file = Pathname config.output @scope = config.scope end |
Instance Attribute Details
#file ⇒ Object (readonly)
Returns the value of attribute file.
168 169 170 |
# File 'lib/bgem.rb', line 168 def file @file end |
Instance Method Details
#[](string) ⇒ Object
170 171 172 173 174 175 176 177 178 179 180 |
# File 'lib/bgem.rb', line 170 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 |