Class: RubyEdit::Commands::Edit

Inherits:
Object
  • Object
show all
Defined in:
lib/ruby_edit/commands/edit.rb

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ Edit

Returns a new instance of Edit.



13
14
15
16
17
18
19
# File 'lib/ruby_edit/commands/edit.rb', line 13

def initialize(options)
  @grep       = RubyEdit::Grep.new(options)
  @sourcefile = RubyEdit::SourceFile.new
  @editor     = RubyEdit::Editor.new
  @output     = $stdout
  @errors     = $stderr
end

Instance Method Details

#executeObject



21
22
23
24
25
26
27
# File 'lib/ruby_edit/commands/edit.rb', line 21

def execute
  return unless grep_search
  populate_sourcefile
  edit_file
  apply_changes if apply_changes?
  delete_sourcefile
end