Sha256: b89e3839ec674549219f12cf479e5c1821d14532de044d52034aa4150f6b24a9

Contents?: true

Size: 743 Bytes

Versions: 4

Compression:

Stored size: 743 Bytes

Contents

module XFTP
  module Operations
    module FTP
      # Provides a naive glob operation implementation, using (see FTP#nlst) method
      # @api private
      # @see Net::FTP#nslt
      # @note It isn't tested on Windows OS and chances are that it won't work,
      #   that's why it is implemented as a separate "command"
      class Glob
        def initialize(ftp)
          @ftp = ftp
        end

        # Expands pattern and returns the results
        # as matches or as arguments given to the block
        # @param [String] pattern the search pattern
        # @param [Proc] callback
        def call(pattern, &callback)
          @ftp.nlst(pattern).each { |filename| callback.call(filename) }
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
xftp-0.3.3 lib/xftp/operations/ftp/glob.rb
xftp-0.3.1 lib/xftp/operations/ftp/glob.rb
xftp-0.2.1.pre.alpha lib/xftp/operations/ftp/glob.rb
xftp-0.2.0.pre.alpha lib/xftp/operations/ftp/glob.rb