Module: ShellTest::FileMethods::ClassMethods
- Defined in:
- lib/shell_test/file_methods.rb
Instance Attribute Summary collapse
-
#class_dir ⇒ Object
Returns the value of attribute class_dir.
-
#paths_to_cleanup_registry ⇒ Object
readonly
A registry tracking paths_to_cleanup for the current class.
Instance Method Summary collapse
-
#paths_to_cleanup ⇒ Object
A hash of (method_name, [relative_path]) pairs identifying which relative paths on each method have been marked on this class or inherited from ancestors.
-
#reset_paths_to_cleanup ⇒ Object
Resets paths_to_cleanup such that it will be recalculated.
Instance Attribute Details
#class_dir ⇒ Object
Returns the value of attribute class_dir.
7 8 9 |
# File 'lib/shell_test/file_methods.rb', line 7 def class_dir @class_dir end |
#paths_to_cleanup_registry ⇒ Object (readonly)
A registry tracking paths_to_cleanup for the current class.
10 11 12 |
# File 'lib/shell_test/file_methods.rb', line 10 def paths_to_cleanup_registry @paths_to_cleanup_registry end |
Instance Method Details
#paths_to_cleanup ⇒ Object
A hash of (method_name, [relative_path]) pairs identifying which relative paths on each method have been marked on this class or inherited from ancestors. Entries in paths_to_cleanup should not be edited directly. Instead use:
cleanup : turn on cleanup for methods
do_not_cleanup : turn off cleanup for methods
default_paths_to_cleanup : set the default paths to cleanup
Or if you need very precise editing, use (with the same semantics as define/remove/undef_method):
define_paths_to_cleanup
remove_paths_to_cleanup
undef_paths_to_cleanup
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/shell_test/file_methods.rb', line 28 def paths_to_cleanup @paths_to_cleanup ||= begin paths_to_cleanup = {} ancestors.reverse.each do |ancestor| next unless ancestor.kind_of?(ClassMethods) ancestor.paths_to_cleanup_registry.each_pair do |key, value| if value.nil? paths_to_cleanup.delete(key) else paths_to_cleanup[key] = value end end end paths_to_cleanup end end |
#reset_paths_to_cleanup ⇒ Object
Resets paths_to_cleanup such that it will be recalculated.
48 49 50 |
# File 'lib/shell_test/file_methods.rb', line 48 def reset_paths_to_cleanup @paths_to_cleanup = nil end |