Sha256: 8c2b28dc49bc34ab51c4dace9b75d953263179a37ae4622528f30c6e123cdbc3
Contents?: true
Size: 664 Bytes
Versions: 2
Compression:
Stored size: 664 Bytes
Contents
module Mercy class ReportConfig attr_accessor :config delegate :[], :[]=, :merge, to: :config def initialize(config) @config = config end def build(parameters) params = slice_parameters(parameters) report_class.new(config.merge(params)) end private def type self[:type] ||= :error end def report_class return type if type.is_a?(Class) @report_class ||= Mercy::Report.const_get(type.to_s.camelize) end def slice_parameters(parameters) parameters.slice(*allowed_parameters) end def allowed_parameters report_class::ALLOWED_PARAMETERS end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
mercy-1.6.0 | lib/mercy/report_config.rb |
mercy-1.5.0 | lib/mercy/report_config.rb |