Class: LibGems::FileOperations
- Inherits:
-
Object
- Object
- LibGems::FileOperations
- Defined in:
- lib/libgems/package.rb
Overview
Wrapper for FileUtils meant to provide logging and additional operations if needed.
Instance Method Summary collapse
-
#initialize(logger = nil) ⇒ FileOperations
constructor
A new instance of FileOperations.
- #method_missing(meth, *args, &block) ⇒ Object
Constructor Details
#initialize(logger = nil) ⇒ FileOperations
Returns a new instance of FileOperations.
23 24 25 |
# File 'lib/libgems/package.rb', line 23 def initialize(logger = nil) @logger = logger end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(meth, *args, &block) ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/libgems/package.rb', line 27 def method_missing(meth, *args, &block) case when FileUtils.respond_to?(meth) @logger.log "#{meth}: #{args}" if @logger FileUtils.send meth, *args, &block when LibGems::FileOperations.respond_to?(meth) @logger.log "#{meth}: #{args}" if @logger LibGems::FileOperations.send meth, *args, &block else super end end |