Sha256: 17d2de3c88ce1e191a5b56e5e67524c3aa26fd854e40d00c571f5b24af512db8
Contents?: true
Size: 1.03 KB
Versions: 149
Compression:
Stored size: 1.03 KB
Contents
# frozen_string_literal: true require 'eac_fs/traverser' module EacFs module Traversable PROP_METHOD_PREFIX = 'traverser_' BOOLEAN_PROPS = %i[hidden_directories recursive sort].freeze PATH_PROPS = %i[check_directory check_file].freeze class << self def prop_method_name(prop) "#{PROP_METHOD_PREFIX}#{prop}" end end PATH_PROPS.each do |method| define_method(::EacFs::Traversable.prop_method_name(method)) do |_path| nil end end BOOLEAN_PROPS.each do |method| define_method(::EacFs::Traversable.prop_method_name(method)) do false end define_method("#{::EacFs::Traversable.prop_method_name(method)}?") do send(method_name) end end def traverser_check_path(path) traverser_new.check_path(path) end def traverser_new r = ::EacFs::Traverser.new (BOOLEAN_PROPS + PATH_PROPS).each do |prop| r.send("#{prop}=", method(::EacFs::Traversable.prop_method_name(prop))) end r end end end
Version data entries
149 entries across 149 versions & 4 rubygems