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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 03cd8fdb5370f00778fdcf3a7d4952e8857bcacb29e30041014e194f3aac3235
4
- data.tar.gz: 729af26cecf79d7ab156b9d1154fb8de7ce2c36c96f688b1cce6ad1aaf65ab72
3
+ metadata.gz: 5b9f828a1aebc9247bda77cd87ef78e5a6c0a98c2bc8979af6ad17ba2a4abf8a
4
+ data.tar.gz: 64632f85e2b547c465fae51126797c330477b317424e51ac247a9bc42bb1ad6a
5
5
  SHA512:
6
- metadata.gz: 6c867469fb7c706b018120990b0799d694078807feaa4f44bd6da5ff4e430459b4bd6d2d4d817efe4a4ef2773619d8d9c71a6cd9d1e84c435c58a64d00499ee4
7
- data.tar.gz: a378e97948ddd807d86696b7ac1536cde072d3fa626b2baed4525a02b4c871cfe4c5157768ddb292255107a74a44da3e972dd2d4ffe8fb489bb91041d9d10879
6
+ metadata.gz: 8786c7f31eb3ba46eb5276d0f58475b989e13e64a0855bbe53eca437b6e8887175f5a87f200e391781159db42033999c9f5a055b504600c41d3cdf36c7835e5b
7
+ data.tar.gz: f9adbea86379cea672e94e80fa33f555215336145f805af21181899777d770814df3e964d68678bafd985f3b90cd072f209c53296ea0cc5d9c594b58ab149662
data/.gitignore CHANGED
@@ -9,3 +9,4 @@
9
9
 
10
10
  # rspec failure tracking
11
11
  .rspec_status
12
+ *.gem
data/Gemfile.lock CHANGED
@@ -2,7 +2,7 @@ PATH
2
2
  remote: .
3
3
  specs:
4
4
  activemodel-logger_attributes (0.1.0)
5
- activemodel (> 4)
5
+ activemodel (> 4, < 6)
6
6
 
7
7
  GEM
8
8
  remote: https://rubygems.org/
data/README.md CHANGED
@@ -9,7 +9,7 @@ You may be also be interested in the (ActiveRecord version)[https://github.com/c
9
9
  Add this line to your application's Gemfile:
10
10
 
11
11
  ```ruby
12
- gem 'activemodel-logger_attributes'
12
+ gem 'activemodel-logger_attributes', '~> 0.1.1'
13
13
  ```
14
14
 
15
15
  And then execute:
@@ -1,5 +1,5 @@
1
1
  module ActiveModel
2
2
  module LoggerAttributes
3
- VERSION = '0.1.0'.freeze
3
+ VERSION = '0.1.1'.freeze
4
4
  end
5
5
  end
@@ -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 logger_attr(attribute, options = {})
16
- attribute = attribute.to_sym
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] = DEFAULT_OPTIONS.merge(options)
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.0
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-05 00:00:00.000000000 Z
11
+ date: 2018-02-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activemodel