Class: Listen::Record
- Inherits:
-
Object
- Object
- Listen::Record
- Defined in:
- lib/gotta/mod/monkey_patch.rb
Instance Method Summary collapse
Instance Method Details
#_sub_dir_entries(rel_path) ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/gotta/mod/monkey_patch.rb', line 23 def _sub_dir_entries(rel_path) result = {} tree.each do |path, | next if !path.start_with?(rel_path) if path == rel_path result.merge!() else sub_path = path.sub(%r{\A#{rel_path}/?}, '') result[sub_path] = end end result end |
#dir_entries(rel_path) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/gotta/mod/monkey_patch.rb', line 7 def dir_entries(rel_path) subtree = if [nil, '', '.'].include? rel_path.to_s tree else _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 |