spring_onion 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: cfc3f0d5560a94e94ae9e4c0e4801b9a9a02e4fd9b5bb74b6b59d9569a6d8613
4
- data.tar.gz: 1d12d7b4b1e984eb1b9c0383b0a82a49f79ee5d47e5ccb12b342a0182dda572d
3
+ metadata.gz: 9029f4da9a3fa2875d738d9bd505fef3784ac40987453f30974eb3ce1d226bf8
4
+ data.tar.gz: 53eaebd2f28fa3257a9477e2fc498f08be2e944375a9316a1d746c58f6b37f4e
5
5
  SHA512:
6
- metadata.gz: 0eff35cb7949993b9161dae0d4d89b3714d513e8b6a80272c214e8a19d4b56381382fc52640773c324d896e0f7f2d9ea50ff992306cf6272506334d3f0ab5dbe
7
- data.tar.gz: 1fcd2d6d57328bc7272cdff88626fd9396837faad035b6c5f1377687a97d502ea357798889b6011d6dcb68e59ad03b112ee08bb27ea7a3aceb2ce313fd074872
6
+ metadata.gz: 8013cf7f3086f2f0ee8abfb6261327f98f0983adc3adb1dd2945b5cc6039e68e979181f77ed95c4d87825cd32ab54cb6baf497e47c1c7424211cc27628d93d4f
7
+ data.tar.gz: 57cf5c24c5bf52b543c64a281b2474612ba0861f85180748d92ee26fcf420675477004d8dd73a1f5e59fa8d1297e0092746767292073a03bbd888a916a153c1a
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- spring_onion (0.1.0)
4
+ spring_onion (0.1.1)
5
5
  activerecord
6
6
  mysql2
7
7
 
data/README.md CHANGED
@@ -33,7 +33,7 @@ ActiveRecord::Base.establish_connection(
33
33
  database: 'employees',
34
34
  )
35
35
 
36
- SpringOnion.enabled = true
36
+ SpringOnion.enabled = true # or `SPRING_ONION_ENABLED=1`
37
37
  SpringOnion.connection = ActiveRecord::Base.connection.raw_connection
38
38
  SpringOnion.source_filter_re = //
39
39
 
@@ -25,17 +25,17 @@ module SpringOnion
25
25
  slow_extra: ->(exp) { SLOW_EXTRA_RE =~ exp['Extra'] },
26
26
  }
27
27
 
28
- @enabled = ENV.fetch('SPRING_ONION_ENABLED', '') =~ /\A(1|true)\z/i
28
+ @enabled = (/\A(1|true)\z/i =~ ENV['SPRING_ONION_ENABLED'])
29
29
 
30
- @sql_filter_re = if ENV.fetch('SPRING_ONION_SQL_FILTER_RE', '').empty?
31
- //
32
- else
33
- Regexp.new(ENV['SPRING_ONION_SQL_FILTER_RE'])
34
- end
30
+ @sql_filter_re = ENV['SPRING_ONION_SQL_FILTER_RE'].yield_self do |re|
31
+ re ? Regexp.new(re) : //
32
+ end
35
33
 
36
34
  @ignore_sql_filter_re = Regexp.union(
37
- /\binformation_schema\b/,
38
- *(ENV.fetch('SPRING_ONION_IGNORE_SQL_FILTER_RE', '').empty? ? nil : Regexp.new(ENV['SPRING_ONION_IGNORE_SQL_FILTER_RE']))
35
+ [/\binformation_schema\b/].tap do |ary|
36
+ re = ENV['SPRING_ONION_IGNORE_SQL_FILTER_RE']
37
+ ary << Regexp.new(re) if re
38
+ end
39
39
  )
40
40
 
41
41
  @sql_filter = lambda do |sql|
@@ -43,13 +43,17 @@ module SpringOnion
43
43
  end
44
44
 
45
45
  @source_filter_re = Regexp.union(
46
- %r{/app/},
47
- *(ENV.fetch('SPRING_ONION_SOURCE_FILTER_RE', '').empty? ? nil : Regexp.new(ENV['SPRING_ONION_SOURCE_FILTER_RE']))
46
+ [%r{/app/}].tap do |ary|
47
+ re = ENV['SPRING_ONION_SOURCE_FILTER_RE']
48
+ ary << Regexp.new(re) if re
49
+ end
48
50
  )
49
51
 
50
52
  @ignore_source_filter_re = Regexp.union(
51
- Regexp.union(RbConfig::TOPDIR, *Gem.path),
52
- *(ENV.fetch('SPRING_ONION_IGNORE_SOURCE_FILTER_RE', '').empty? ? nil : Regexp.new(ENV['SPRING_ONION_IGNORE_SOURCE_FILTER_RE']))
53
+ [RbConfig::TOPDIR, *Gem.path].tap do |ary|
54
+ re = ENV['SPRING_ONION_IGNORE_SOURCE_FILTER_RE']
55
+ ary << Regexp.new(re) if re
56
+ end
53
57
  )
54
58
 
55
59
  @source_filter = lambda do |backtrace_lines|
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module SpringOnion
4
- VERSION = '0.1.0'
4
+ VERSION = '0.1.1'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: spring_onion
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
  - winebarrel