Class: Redisk::Logger
- Inherits:
-
Object
- Object
- Redisk::Logger
- Extended by:
- Helper
- Includes:
- Helper
- Defined in:
- lib/redisk/logger.rb
Instance Attribute Summary collapse
-
#io ⇒ Object
readonly
Returns the value of attribute io.
-
#logger ⇒ Object
readonly
Returns the value of attribute logger.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
-
#initialize(name, options = {}) ⇒ Logger
constructor
A new instance of Logger.
- #length ⇒ Object
-
#method_missing(meth, *args) ⇒ Object
delegate to logger.
- #truncate! ⇒ Object
Methods included from Helper
Constructor Details
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(meth, *args) ⇒ Object
delegate to logger
25 26 27 28 29 30 31 32 33 |
# File 'lib/redisk/logger.rb', line 25 def method_missing(meth, *args) if @logger.respond_to?(meth) returned = @logger.send(meth, *args) truncate! returned else super end end |
Instance Attribute Details
#io ⇒ Object (readonly)
Returns the value of attribute io.
7 8 9 |
# File 'lib/redisk/logger.rb', line 7 def io @io end |
#logger ⇒ Object (readonly)
Returns the value of attribute logger.
7 8 9 |
# File 'lib/redisk/logger.rb', line 7 def logger @logger end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
7 8 9 |
# File 'lib/redisk/logger.rb', line 7 def name @name end |
Instance Method Details
#length ⇒ Object
16 17 18 |
# File 'lib/redisk/logger.rb', line 16 def length @io.length end |
#truncate! ⇒ Object
20 21 22 |
# File 'lib/redisk/logger.rb', line 20 def truncate! @io.truncate(@truncate) if @truncate && length > @truncate end |