public
Description: Vim plugin for debugging Ruby applications (using ruby-debug-ide gem)
Homepage:
Clone URL: git://github.com/astashov/vim-ruby-debugger.git
Anton Astashov (author)
Thu Nov 05 19:51:02 -0800 2009
vim-ruby-debugger / collector.rb
100644 44 lines (31 sloc) 0.885 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
class Collector
 
  def initialize(input, output)
    @path = File.dirname(__FILE__)
    @input_files = input.map{|i| @path + '/' + i}
    @output_file = @path + '/' + output
    @file = ''
  end
  
  def accumulate!
    read_file
    save_file
  end
 
  
  protected
  
    def read_file
      @file = ""
      plan = @input_files.inject([]) {|sum, i| sum += File.read(i).split("\n") }
      plan.each do |line|
        @file += File.read(@path + '/' + line)
        @file += "\n"
      end
      @file
    end
    
    
    def save_file
      File.open(@output_file, 'w') do |file|
        file.write(@file)
      end
    end
  
end
 
 
common = Collector.new(['ruby_debugger_plan.txt'], 'vim/plugin/ruby_debugger.vim')
common.accumulate!
 
 
with_tests = Collector.new(['ruby_debugger_plan.txt', 'ruby_test_plan.txt'], 'additionals/plugin/ruby_debugger_test.vim')
with_tests.accumulate!