Class: Shell::Glob
Relationships & Source Files | |
Super Chains via Extension / Inclusion / Inheritance | |
Class Chain:
self,
BuiltInCommand,
Filter
|
|
Instance Chain:
self,
BuiltInCommand,
Filter,
Enumerable
|
|
Inherits: |
Shell::BuiltInCommand
|
Defined in: | lib/shell/builtin-command.rb |
Class Method Summary
Instance Attribute Summary
Instance Method Summary
Filter - Inherited
#+ | Outputs |
#< | Inputs from |
#> | Outputs from |
#>> | Appends the output to |
#each | Iterates a block for each line. |
#inspect, #to_a, #to_s, | |
#| | Processes a pipeline. |
Constructor Details
.new(sh, pattern) ⇒ Glob
# File 'lib/shell/builtin-command.rb', line 67
def initialize(sh, pattern) super sh @pattern = pattern end
Instance Method Details
#each(rs = nil)
[ GitHub ]# File 'lib/shell/builtin-command.rb', line 73
def each(rs = nil) if @pattern[0] == ?/ @files = Dir[@pattern] else prefix = @shell.pwd+"/" @files = Dir[prefix+@pattern].collect{|p| p.sub(prefix, "")} end rs = @shell.record_separator unless rs for f in @files yield f+rs end end