class ExceptionNotifier::FluentLoggerNotifier::Argument

Public Class Methods

build(template, exception, options = {}) click to toggle source
# File lib/exception_notifier/fluent_logger_notifier.rb, line 39
def self.build(template, exception, options = {})
  self.new(template, exception, options).build
end
new(template, exception, options = {}) click to toggle source
# File lib/exception_notifier/fluent_logger_notifier.rb, line 29
def initialize(template, exception, options = {})
  @exception = exception
  @options = options
  @template = template
end

Public Instance Methods

build() click to toggle source
# File lib/exception_notifier/fluent_logger_notifier.rb, line 35
def build
  expand_object(@template)
end

Private Instance Methods

expand_array(array) click to toggle source
# File lib/exception_notifier/fluent_logger_notifier.rb, line 62
def expand_array(array)
  array.map {|element| expand_object(element) }
end
expand_hash(hash) click to toggle source
# File lib/exception_notifier/fluent_logger_notifier.rb, line 66
def expand_hash(hash)
  {}.tap do |result|
    hash.each do |k, v|
      result[k] = expand_object(v)
    end
  end
end
expand_object(obj) click to toggle source
# File lib/exception_notifier/fluent_logger_notifier.rb, line 45
def expand_object(obj)
  case obj
  when Hash
    expand_hash(obj)
  when Array
    expand_array(obj)
  when Proc
    expand_proc(obj)
  else
    obj
  end
end
expand_proc(prok) click to toggle source
# File lib/exception_notifier/fluent_logger_notifier.rb, line 58
def expand_proc(prok)
  expand_object(prok.call(@exception, @options))
end