Module: EacRubyUtils::Fs::Traversable

Defined in:
lib/eac_ruby_utils/fs/traversable.rb

Constant Summary collapse

PROP_METHOD_PREFIX =
'traverser_'
BOOLEAN_PROPS =
%i[hidden_directories recursive sort].freeze
PATH_PROPS =
%i[check_directory check_file].freeze

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.prop_method_name(prop) ⇒ Object


13
14
15
# File 'lib/eac_ruby_utils/fs/traversable.rb', line 13

def prop_method_name(prop)
  "#{PROP_METHOD_PREFIX}#{prop}"
end

Instance Method Details

#traverser_check_path(path) ⇒ Object


34
35
36
# File 'lib/eac_ruby_utils/fs/traversable.rb', line 34

def traverser_check_path(path)
  traverser_new.check_path(path)
end

#traverser_newObject


38
39
40
41
42
43
44
# File 'lib/eac_ruby_utils/fs/traversable.rb', line 38

def traverser_new
  r = ::EacRubyUtils::Fs::Traverser.new
  (BOOLEAN_PROPS + PATH_PROPS).each do |prop|
    r.send("#{prop}=", method(::EacRubyUtils::Fs::Traversable.prop_method_name(prop)))
  end
  r
end