Module: Service::Initializer

Included in:
Service
Defined in:
app/concerns/service.rb

Overview

Prepended before ActiveModel so logger can be extracted from attrs
before they are handed to ActiveModel::Attributes#initialize.

Instance Method Summary collapse

Instance Method Details

#initialize(attrs = {}) ⇒ Object



8
9
10
11
12
# File 'app/concerns/service.rb', line 8

def initialize(attrs = {})
  attrs = attrs.is_a?(Hash) ? attrs.dup : {}
  @logger = attrs.delete(:logger) || attrs.delete('logger')
  super(attrs)
end