Class: RubyGrep::Directory
- Inherits:
-
Object
- Object
- RubyGrep::Directory
- Defined in:
- lib/ruby-grep/directory.rb
Instance Method Summary collapse
-
#files ⇒ Object
this method finds all entries in the @path (directory) including all in all sudirectories of the given @path and returns them as an array of elements of type RubyGrep::File.
-
#initialize(path) ⇒ Directory
constructor
A new instance of Directory.
Constructor Details
#initialize(path) ⇒ Directory
Returns a new instance of Directory.
5 6 7 |
# File 'lib/ruby-grep/directory.rb', line 5 def initialize(path) @path = path end |
Instance Method Details
#files ⇒ Object
this method finds all entries in the @path (directory) including all in all sudirectories of the given @path and returns them as an array of elements of type RubyGrep::File
11 12 13 14 |
# File 'lib/ruby-grep/directory.rb', line 11 def files @files ||= Dir.glob(::File.join("#{@path}", "**", "{*,.*}")).select { |f| ::File.file?(f) }. map { |file_name| RubyGrep::File.new("#{file_name}") } end |