class DBA::RowEditor

Public Class Methods

new(row_parser) click to toggle source
# File lib/dba/row_editor.rb, line 4
def initialize(row_parser)
  @row_parser = row_parser

  @editor = ENV['EDITOR']
end

Public Instance Methods

edit(hash) click to toggle source
# File lib/dba/row_editor.rb, line 10
def edit(hash)
  io = IO.popen(@editor, 'w+')

  printer = DBA::Printer.new(io)
  printer.print_row(hash)

  io.close_write

  output = io.read

  io.close

  @row_parser.parse(output)
end