Class: Logbert::Formatters::ProcFormatter
- Defined in:
- lib/logbert/formatters.rb
Instance Attribute Summary collapse
-
#proc ⇒ Object
Returns the value of attribute proc.
Instance Method Summary collapse
- #format(msg) ⇒ Object
-
#initialize(&block) ⇒ ProcFormatter
constructor
A new instance of ProcFormatter.
Constructor Details
#initialize(&block) ⇒ ProcFormatter
Returns a new instance of ProcFormatter.
38 39 40 41 |
# File 'lib/logbert/formatters.rb', line 38 def initialize(&block) raise ArgumentError, "ProcFormatter must be initialized with a block" unless block_given? @proc = block end |
Instance Attribute Details
#proc ⇒ Object
Returns the value of attribute proc.
36 37 38 |
# File 'lib/logbert/formatters.rb', line 36 def proc @proc end |
Instance Method Details
#format(msg) ⇒ Object
43 44 45 |
# File 'lib/logbert/formatters.rb', line 43 def format(msg) @proc.call msg end |