Class: Cleaner::Directory
- Inherits:
-
Object
- Object
- Cleaner::Directory
- Defined in:
- lib/cleaner/directory.rb
Instance Attribute Summary collapse
-
#block ⇒ Object
readonly
Returns the value of attribute block.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
Instance Method Summary collapse
- #clean ⇒ Object
-
#initialize(path, block) ⇒ Directory
constructor
A new instance of Directory.
Constructor Details
#initialize(path, block) ⇒ Directory
Returns a new instance of Directory.
5 6 7 8 |
# File 'lib/cleaner/directory.rb', line 5 def initialize(path, block) @path = path @block = block end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *args, &block) ⇒ Object (protected)
16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/cleaner/directory.rb', line 16 def method_missing(method, *args, &block) action_class = construct_action_class(method) # FIXME: refactor this argument parsing = args.last.is_a?(Hash) ? args.last : {} = .merge( :pattern => args.first.is_a?(Hash) ? nil : args.first, :path => path ) filter = FileFilter.new() action = action_class.new(filter.filterize, ) action.execute end |
Instance Attribute Details
#block ⇒ Object (readonly)
Returns the value of attribute block.
3 4 5 |
# File 'lib/cleaner/directory.rb', line 3 def block @block end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
3 4 5 |
# File 'lib/cleaner/directory.rb', line 3 def path @path end |
Instance Method Details
#clean ⇒ Object
10 11 12 |
# File 'lib/cleaner/directory.rb', line 10 def clean instance_eval(&block) end |