]> git.openstreetmap.org Git - rails.git/blob - vendor/gems/rspec-1.1.2/examples/pure/file_accessor.rb
added RSpec and RSpec on Rails
[rails.git] / vendor / gems / rspec-1.1.2 / examples / pure / file_accessor.rb
1 require File.dirname(__FILE__) + '/spec_helper'
2 class FileAccessor
3   def open_and_handle_with(pathname, processor)
4     pathname.open do |io|
5       processor.process(io)
6     end
7   end
8 end
9
10 if __FILE__ == $0
11   require File.dirname(__FILE__) + '/io_processor'
12   require 'pathname'
13   
14   accessor = FileAccessor.new
15   io_processor = IoProcessor.new
16   file = Pathname.new ARGV[0]
17
18   accessor.open_and_handle_with(file, io_processor)
19 end