Class: MethodLogger
- Inherits:
-
Object
- Object
- MethodLogger
- Defined in:
- lib/s3fsr.rb
Instance Method Summary collapse
-
#initialize(obj) ⇒ MethodLogger
constructor
A new instance of MethodLogger.
- #method_missing(sym, *args, &block) ⇒ Object
Constructor Details
#initialize(obj) ⇒ MethodLogger
Returns a new instance of MethodLogger.
341 342 343 |
# File 'lib/s3fsr.rb', line 341 def initialize(obj) @obj = obj end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(sym, *args, &block) ⇒ Object
344 345 346 347 348 349 350 351 352 353 354 355 356 357 |
# File 'lib/s3fsr.rb', line 344 def method_missing(sym, *args, &block) begin puts "#{sym}(#{args})" unless sym == :respond_to? or sym == :write_to puts "#{sym}(#{args[0].length})" if sym == :write_to result = @obj.__send__(sym, *args, &block) puts " #{result}" unless sym == :respond_to? or sym == :read_file puts " #{result.length}" if sym == :read_file result rescue => e puts " #{e.inspect}" puts " #{e.backtrace}" raise $? end end |