Class: Shell::Glob
- Inherits:
-
BuiltInCommand
- Object
- Filter
- BuiltInCommand
- Shell::Glob
- Defined in:
- lib/shell/builtin-command.rb
Instance Attribute Summary
Attributes inherited from Filter
Instance Method Summary collapse
- #each(rs = nil) ⇒ Object
-
#initialize(sh, pattern) ⇒ Glob
constructor
A new instance of Glob.
Methods inherited from BuiltInCommand
Methods inherited from Filter
#+, #<, #>, #>>, #inspect, #to_a, #to_s, #|
Constructor Details
#initialize(sh, pattern) ⇒ Glob
Returns a new instance of Glob.
57 58 59 60 61 62 63 64 65 66 67 68 69 70 |
# File 'lib/shell/builtin-command.rb', line 57 def initialize(sh, pattern) super sh @pattern = pattern Thread.critical = true back = Dir.pwd begin Dir.chdir @shell.cwd @files = Dir[pattern] ensure Dir.chdir back Thread.critical = false end end |
Instance Method Details
#each(rs = nil) ⇒ Object
72 73 74 75 76 77 |
# File 'lib/shell/builtin-command.rb', line 72 def each(rs = nil) rs = @shell.record_separator unless rs for f in @files yield f+rs end end |