Class: Globby::GlObject
- Inherits:
-
Object
- Object
- Globby::GlObject
- Defined in:
- lib/globby/globject.rb
Instance Attribute Summary collapse
-
#dirs ⇒ Object
readonly
Returns the value of attribute dirs.
-
#files ⇒ Object
readonly
Returns the value of attribute files.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(files = Set.new, dirs = Set.new) ⇒ GlObject
constructor
A new instance of GlObject.
Constructor Details
#initialize(files = Set.new, dirs = Set.new) ⇒ GlObject
Returns a new instance of GlObject.
5 6 7 8 |
# File 'lib/globby/globject.rb', line 5 def initialize(files = Set.new, dirs = Set.new) @files = files @dirs = dirs end |
Instance Attribute Details
#dirs ⇒ Object (readonly)
Returns the value of attribute dirs.
3 4 5 |
# File 'lib/globby/globject.rb', line 3 def dirs @dirs end |
#files ⇒ Object (readonly)
Returns the value of attribute files.
3 4 5 |
# File 'lib/globby/globject.rb', line 3 def files @files end |
Class Method Details
.all ⇒ Object
10 11 12 13 14 15 16 |
# File 'lib/globby/globject.rb', line 10 def self.all files, dirs = Dir.glob('**/*', File::FNM_DOTMATCH). reject { |f| f =~ /(\A|\/)\.\.?\z/ }. partition { |f| File.file?(f) || File.symlink?(f) } dirs.map!{ |d| d + "/" } new(files, dirs) end |