activemodel-logger_attributes 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/Gemfile.lock +1 -1
- data/README.md +1 -1
- data/lib/active_model/logger_attributes/version.rb +1 -1
- data/lib/active_model/logger_attributes.rb +12 -5
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5b9f828a1aebc9247bda77cd87ef78e5a6c0a98c2bc8979af6ad17ba2a4abf8a
|
4
|
+
data.tar.gz: 64632f85e2b547c465fae51126797c330477b317424e51ac247a9bc42bb1ad6a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8786c7f31eb3ba46eb5276d0f58475b989e13e64a0855bbe53eca437b6e8887175f5a87f200e391781159db42033999c9f5a055b504600c41d3cdf36c7835e5b
|
7
|
+
data.tar.gz: f9adbea86379cea672e94e80fa33f555215336145f805af21181899777d770814df3e964d68678bafd985f3b90cd072f209c53296ea0cc5d9c594b58ab149662
|
data/.gitignore
CHANGED
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -7,18 +7,25 @@ module ActiveModel
|
|
7
7
|
module LoggerAttributes
|
8
8
|
extend ActiveSupport::Concern
|
9
9
|
|
10
|
-
DEFAULT_OPTIONS = { logger_class: ::Logger, logger_name: nil, logger_init: -> {} }.freeze
|
11
|
-
|
12
10
|
InvalidAttributeValue = Class.new(RuntimeError)
|
13
11
|
|
14
12
|
module ClassMethods
|
15
|
-
def
|
16
|
-
|
13
|
+
def logger_attr_default_options
|
14
|
+
{ logger_class: ::Logger, logger_name: nil, logger_init: ->(l) {} }
|
15
|
+
end
|
16
|
+
|
17
|
+
def setup_logger_attr(attribute, options)
|
18
|
+
puts "DEFAULTS: #{logger_attr_default_options.ai}"
|
17
19
|
@logger_attributes ||= {}
|
18
|
-
@logger_attributes[attribute] =
|
20
|
+
@logger_attributes[attribute] = logger_attr_default_options.merge(options)
|
19
21
|
@logger_attributes[attribute][:logger_name] ||= "#{attribute}_logger"
|
20
22
|
define_logger_attr_initializer(attribute)
|
21
23
|
define_logger_attr_accessor(attribute)
|
24
|
+
end
|
25
|
+
|
26
|
+
def logger_attr(attribute, options = {})
|
27
|
+
attribute = attribute.to_sym
|
28
|
+
setup_logger_attr(attribute, options)
|
22
29
|
attr_accessor(attribute)
|
23
30
|
end
|
24
31
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: activemodel-logger_attributes
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chris Bielinski
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-02-
|
11
|
+
date: 2018-02-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activemodel
|