Class: FileFeeder
- Inherits:
-
Object
- Object
- FileFeeder
- Includes:
- Enumerable
- Defined in:
- lib/ruby_diff/file_feeder.rb
Instance Attribute Summary collapse
-
#files ⇒ Object
Returns the value of attribute files.
-
#path ⇒ Object
Returns the value of attribute path.
Instance Method Summary collapse
- #each ⇒ Object
-
#initialize(path) ⇒ FileFeeder
constructor
Expects something in the form of PATH –file [PATH].
Constructor Details
#initialize(path) ⇒ FileFeeder
Expects something in the form of PATH
--file [PATH]
9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/ruby_diff/file_feeder.rb', line 9 def initialize(path) @path = path if path =~ /^\s+$/ @file_pattern = "**/*.rb" elsif File.file? path @file_pattern = path else @file_pattern = File.join(path, "**/*.rb") end @files = Dir[@file_pattern] end |
Instance Attribute Details
#files ⇒ Object
Returns the value of attribute files.
2 3 4 |
# File 'lib/ruby_diff/file_feeder.rb', line 2 def files @files end |
#path ⇒ Object
Returns the value of attribute path.
3 4 5 |
# File 'lib/ruby_diff/file_feeder.rb', line 3 def path @path end |
Instance Method Details
#each ⇒ Object
22 23 24 25 26 |
# File 'lib/ruby_diff/file_feeder.rb', line 22 def each @files.each do |file| yield(open(file, 'r'){|io| io.read}) end end |