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.
25 26 27 28 |
# File 'lib/logbert/formatters.rb', line 25 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.
23 24 25 |
# File 'lib/logbert/formatters.rb', line 23 def proc @proc end |
Instance Method Details
#format(msg) ⇒ Object
30 31 32 |
# File 'lib/logbert/formatters.rb', line 30 def format(msg) @proc.call msg end |