ruby_smart-simple_logger 1.2.1 → 1.2.2

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: d4f5d3ae3592f31b6c012044205c37d859c9e809d58f8cce63c7b6b2ed634829
4
- data.tar.gz: d50becd65a8386e2466ddebcbbbd6bf2ec92aad95f4c5ae76288974429d607bc
3
+ metadata.gz: f93f509aad065f314393b0b7f630694091fb06c967bc20ad1fe4e0b7683f843b
4
+ data.tar.gz: 9d5a325fac9bc01ad330cec1c1c31a9bc3f5602e1934893b04ab5f3baed22ac0
5
5
  SHA512:
6
- metadata.gz: dbe6aab96f5a2f67f85fd5147462d65e0f8496a1271406710f4d9e8b5df3a245c8f7e1292a9ac3f548973a204442332abafe21a8a97b6724f25a513b3eef7148
7
- data.tar.gz: 5165beba92525197a3d9359bc7513c15e4aa6057a3bea5902870541141fe9ca4fdb3b4f6270eefcbbbf7ca75aff209e03cf39d4d8eb00d34e3292a45e71960ad
6
+ metadata.gz: 5b4b91d4c70cd0e373af89191b9147739a55443e851ffdc8751e3853d833e04f59cd9aa6d125a60c752e924686a190d8bd492560860e91d18749af48adc210d4
7
+ data.tar.gz: 5cb89dd0a2cf9b77f3ce2cbc4bcf7c9f8ee218fb9030a16c9bba0259ac5ca16bf82fcdffef2602533b567b2591d94f672662a46e3562b8a1fdee398980137718
data/docs/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # RubySmart::SimpleLogger - CHANGELOG
2
2
 
3
+ ## [1.2.2] - 2023-03-15
4
+ * **[ref]** simplify device-generation for builtins
5
+ * **[fix]** `ActionView::Helpers::DateHelper` require, which breaks rails loading process in some cases
6
+
3
7
  ## [1.2.1] - 2023-02-17
4
8
  * **[fix]** 'rails'-related builtins
5
9
  * **[fix]** `::RubySmart::SimpleLogger::Devices::MultiDevice` register `MultiDevice` instead of nested devices
@@ -61,36 +61,30 @@ module RubySmart
61
61
  # check for already existing +device+
62
62
  return if opts[:device]
63
63
 
64
- # remove builtin key from opts
65
- builtin = opts.delete(:builtin)
64
+ # remove builtin key from opts and force an array
65
+ builtins = Array(opts.delete(:builtin))
66
66
 
67
- # retransform array into single value
68
- builtin = builtin[0] if builtin.is_a?(Array) && builtin.length < 2
67
+ # expand builtins with stdout
68
+ builtins << :stdout if opts.delete(:stdout)
69
69
 
70
- # expand current builtin with optional provided keywords
71
- if opts.delete(:stdout)
72
- builtin = [builtin] unless builtin.is_a?(Array)
73
- builtin << :stdout
74
- end
70
+ # expand builtins with memory
71
+ builtins << :memory if opts.delete(:memory)
75
72
 
76
- if opts.delete(:memory)
77
- builtin = [builtin] unless builtin.is_a?(Array)
78
- builtin << :memory
79
- end
73
+ builtins.uniq!
80
74
 
81
- # determinate builtin - first check to create +MultiDevice+.
82
- if builtin.is_a?(Array)
75
+ # don't create multi-device for a single (or +nil+) builtin
76
+ if builtins.length < 2
77
+ opts[:device] = _resolve_device(builtins[0], opts)
78
+ else
83
79
  opts[:device] = ::RubySmart::SimpleLogger::Devices::MultiDevice.new
84
- builtin.uniq.each do |key|
80
+ builtins.each do |builtin|
85
81
  # IMPORTANT: dup, original hash to prevent reference manipulation (on the TOP-level, only)
86
82
  builtin_opts = opts.dup
87
- opts[:device].register(_resolve_device(key, builtin_opts), _resolve_formatter(builtin_opts))
83
+ opts[:device].register(_resolve_device(builtin, builtin_opts), _resolve_formatter(builtin_opts))
88
84
  end
89
85
 
90
86
  # force 'passthrough', as format, since this is required for multi-devices
91
87
  opts[:format] = :passthrough
92
- else
93
- opts[:device] = _resolve_device(builtin, opts)
94
88
  end
95
89
 
96
90
  # prevent to return any data
@@ -10,7 +10,7 @@ module RubySmart
10
10
  module VERSION
11
11
  MAJOR = 1
12
12
  MINOR = 2
13
- TINY = 1
13
+ TINY = 2
14
14
  PRE = nil
15
15
 
16
16
  STRING = [MAJOR, MINOR, TINY, PRE].compact.join(".")
@@ -17,9 +17,8 @@ module RubySmart
17
17
  end
18
18
 
19
19
  # load date extensions for logger
20
- if GemInfo.loaded?('activesupport') && GemInfo.installed?('actionview')
21
- ActiveSupport.on_load(:active_record) do
22
- require('action_view/helpers/date_helper')
23
- RubySmart::SimpleLogger::Logger.include(ActionView::Helpers::DateHelper)
24
- end
20
+ # since 'actionview' is loaded in different ways, we only can check for +installed?+ here...
21
+ if GemInfo.installed?('actionview')
22
+ # IMPORTANT: any require will break the loading process
23
+ RubySmart::SimpleLogger::Logger.include(ActionView::Helpers::DateHelper) unless RubySmart::SimpleLogger::Logger.included_modules.include?(ActionView::Helpers::DateHelper)
25
24
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby_smart-simple_logger
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.1
4
+ version: 1.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tobias Gonsior
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-02-17 00:00:00.000000000 Z
11
+ date: 2023-03-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ruby_smart-support