Class: Parxer::Formatter::Custom

Inherits:
Base
  • Object
show all
Defined in:
lib/parxer/formatters/custom_formatter.rb

Instance Attribute Summary

Attributes inherited from Base

#config

Instance Method Summary collapse

Methods inherited from Base

#apply, #initialize

Constructor Details

This class inherits a constructor from Parxer::Formatter::Base

Instance Method Details

#format_value(_v) ⇒ Object



4
5
6
7
8
9
10
# File 'lib/parxer/formatters/custom_formatter.rb', line 4

def format_value(_v)
  if !config[:formatter_proc].is_a?(Proc)
    raise Parxer::FormatterError.new("'formatter_proc' needs to be a Proc")
  end

  instance_eval(&config[:formatter_proc])
end