Module: Caligrafo::Writer
- Included in:
- Caligrafo
- Defined in:
- lib/caligrafo/writer.rb
Defined Under Namespace
Modules: FileExtension
Instance Method Summary collapse
Instance Method Details
#escrever_arquivo(nome, &bloco) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/caligrafo/writer.rb', line 5 def escrever_arquivo(nome, &bloco) raise 'A estrutura nao foi definida' unless self.class.estrutura File.open(nome, 'w') do |file| file.extend FileExtension file.estrutura = self.class.estrutura file.linha = '' file.numero_linha = 0 file.objeto = self file.bloco = bloco bloco.call file end nome end |