Sha256: a9ab17d1868b8ee0bcee1cc8d6731ff1c4e79ac0c1bb410388fb0a84aca88176

Contents?: true

Size: 1019 Bytes

Versions: 30

Compression:

Stored size: 1019 Bytes

Contents

# This is required to address a bug on the Listen gem :(
# See: https://github.com/guard/listen/issues/426
  module Listen
    class Record
      def dir_entries(rel_path)
        subtree =
          if [nil, '', '.'].include? rel_path.to_s
            tree
          else
            # tree[rel_path.to_s] ||= _auto_hash
            # puts tree[rel_path.to_s]
            # tree[rel_path.to_s]
            _sub_dir_entries(rel_path)
          end

        result = {}
        subtree.each do |key, values|
          # only get data for file entries
          result[key] = values.key?(:mtime) ? values : {}
        end
        result
      end

      def _sub_dir_entries(rel_path)
        result = {}
        tree.each do |path, meta|
          next if !path.start_with?(rel_path)
            if path == rel_path
            result.merge!(meta)
          else
            sub_path = path.sub(%r{\A#{rel_path}/?}, '')
            result[sub_path] = meta
          end
        end
        result
      end
    end
  end

Version data entries

30 entries across 30 versions & 1 rubygems

Version Path
faastruby-0.5.30 lib/faastruby/local/monkey_patch.rb
faastruby-0.5.29 lib/faastruby/local/monkey_patch.rb
faastruby-0.5.28 lib/faastruby/local/monkey_patch.rb
faastruby-0.5.27 lib/faastruby/local/monkey_patch.rb
faastruby-0.5.26 lib/faastruby/local/monkey_patch.rb
faastruby-0.5.25 lib/faastruby/local/monkey_patch.rb
faastruby-0.5.24 lib/faastruby/local/monkey_patch.rb
faastruby-0.5.23 lib/faastruby/local/monkey_patch.rb
faastruby-0.5.22 lib/faastruby/local/monkey_patch.rb
faastruby-0.5.21 lib/faastruby/local/monkey_patch.rb
faastruby-0.5.20 lib/faastruby/local/monkey_patch.rb
faastruby-0.5.19 lib/faastruby/local/monkey_patch.rb
faastruby-0.5.18 lib/faastruby/local/monkey_patch.rb
faastruby-0.5.17 lib/faastruby/local/monkey_patch.rb
faastruby-0.5.16 lib/faastruby/local/monkey_patch.rb
faastruby-0.5.15 lib/faastruby/local/monkey_patch.rb
faastruby-0.5.14 lib/faastruby/local/monkey_patch.rb
faastruby-0.5.13 lib/faastruby/local/monkey_patch.rb
faastruby-0.5.12 lib/faastruby/local/monkey_patch.rb
faastruby-0.5.11 lib/faastruby/local/monkey_patch.rb