Method: HP::Cloud::LocalResource#foreach

Defined in:
lib/hpcloud/local_resource.rb

#foreach(&block) ⇒ Object



166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
# File 'lib/hpcloud/local_resource.rb', line 166

def foreach(&block)
  if (isDirectory() == false)
     yield self
    return
  end
  begin
    Dir.foreach(path) { |x|
      if ((x != '.') && (x != '..')) then
        ResourceFactory.create_any(@storage, path + '/' + x).foreach(&block)
      end
    }
  rescue Errno::EACCES
    @cstatus  = CliStatus.new("You don't have permission to access '#{path}'.", :permission_denied)
  end
end