Class: DiffTools::App

Inherits:
Object show all
Defined in:
lib/diff_tools.rb

Instance Method Summary collapse

Constructor Details

#initialize(stdin, stdout, stderr, argv) ⇒ App

Returns a new instance of App.



98
99
100
101
102
103
104
105
106
107
108
# File 'lib/diff_tools.rb', line 98

def initialize ( stdin, stdout, stderr, argv )
  gre, neg, exc = [], [], []
  argv.each do |arg|
    case arg
    when /^(.*)!$/ then exc << $1
    when /^(.*)-$/ then neg << $1
    else gre << arg
    end
  end
  stdout.puts Diff.new(stdin.read).exclude(exc).negative(neg).grep(gre)
end