meta_request 0.8.1 → 0.8.3

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: adf97c47d13a17191df13f4c2a8b44b04d98a8074ab8e31ef511fac4cadc1e85
4
- data.tar.gz: bbbca2ee60cf1a8e0aed094990d350b2d28e2bb10d14d0141f52f0e846335ea0
3
+ metadata.gz: 108596676b5e12bbd5e63c1f7b9ad5ccaf62b435fe8d21a959a30d876c3a6ba1
4
+ data.tar.gz: 496eba3a8c6d7d85897e2a0230ce23addee87c597d00fd0e11959697c1844d05
5
5
  SHA512:
6
- metadata.gz: 9a5600729c606091eb2b7bd713429a30ff854d4bb41f54e6fb6947f3d1d52493cda8737e8658735172b9e395fe14b03898bbf6ebd291c225252969fb7308c48b
7
- data.tar.gz: 3caa4f28eaaf9f348f2bfa098a771da3ef44a3da4d735b5681e1bcff2fe776b776ea72d4bf7e6d760aec923e73269c94d4982b489f7ea17cc6cbcb845eaf018f
6
+ metadata.gz: e1bc81ba1cf6f3cd50c8de7f1b9da7dd4eede6c6362362123e35e5bcbf9535dd26b60bc10c66987f4e9d1df02c9c771a1fc0cf9c7a071dffeee45a01c5188d01
7
+ data.tar.gz: 830ac5ef9e97783c93ff6730ed3d3b65fad1b408c314a4d59b23db2ca5546bc992c92ddf85fe8fd62aec571099be9e9f1da9d69c0ecd7b85d56a5e5fcb80042e
@@ -18,5 +18,17 @@ module MetaRequest
18
18
  def source_path
19
19
  @source_path ||= ENV['SOURCE_PATH'] || Rails.root.to_s
20
20
  end
21
+
22
+ # List of relative paths inside Rails app. Used in Location calculation.
23
+ def ignored_paths
24
+ self.ignored_paths = %w[bin vendor] unless @ignored_paths
25
+ @ignored_paths
26
+ end
27
+
28
+ def ignored_paths=(paths)
29
+ @ignored_paths = paths.map do |path|
30
+ Rails.root.join(path).to_s.freeze
31
+ end.freeze
32
+ end
21
33
  end
22
34
  end
@@ -61,13 +61,15 @@ module MetaRequest
61
61
  payload[:key] = ActiveSupport::Cache::Store.new.send(:normalize_key, payload[:key])
62
62
  end
63
63
 
64
- payload
64
+ payload.except(:locals)
65
65
  end
66
66
 
67
67
  def not_encodable?(value)
68
- (defined?(ActiveRecord) && value.is_a?(ActiveRecord::ConnectionAdapters::AbstractAdapter)) ||
69
- (defined?(ActionDispatch) &&
70
- (value.is_a?(ActionDispatch::Request) || value.is_a?(ActionDispatch::Response)))
68
+ return true if defined?(ActiveRecord) && value.is_a?(ActiveRecord::ConnectionAdapters::AbstractAdapter)
69
+ return true if defined?(ActionDispatch) && (value.is_a?(ActionDispatch::Request) || value.is_a?(ActionDispatch::Response))
70
+ return true if defined?(ActionView) && value.is_a?(ActionView::Helpers::FormBuilder)
71
+
72
+ false
71
73
  end
72
74
 
73
75
  # https://gist.github.com/dbenhur/1070399
@@ -5,7 +5,7 @@ module MetaRequest
5
5
  module_function
6
6
 
7
7
  def dev_callsite(caller)
8
- app_line = caller.detect { |c| c.start_with? MetaRequest.rails_root }
8
+ app_line = caller.detect { |c| valid_application_path? c }
9
9
  return nil unless app_line
10
10
 
11
11
  _, filename, _, line, _, method = app_line.split(/^(.*?)(:(\d+))(:in `(.*)')?$/)
@@ -24,5 +24,15 @@ module MetaRequest
24
24
 
25
25
  path.sub(rails_root, source_path)
26
26
  end
27
+
28
+ def valid_application_path?(path)
29
+ path.start_with?(MetaRequest.rails_root) && !ignored_path?(path)
30
+ end
31
+
32
+ def ignored_path?(path)
33
+ MetaRequest.config.ignored_paths.any? do |ignored_path|
34
+ path.start_with?(ignored_path.to_s)
35
+ end
36
+ end
27
37
  end
28
38
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: meta_request
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.1
4
+ version: 0.8.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dejan Simic
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-04-13 00:00:00.000000000 Z
11
+ date: 2024-09-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rack-contrib
@@ -37,9 +37,9 @@ dependencies:
37
37
  - - ">="
38
38
  - !ruby/object:Gem::Version
39
39
  version: 3.0.0
40
- - - "<="
40
+ - - "<"
41
41
  - !ruby/object:Gem::Version
42
- version: '7'
42
+ version: '8'
43
43
  type: :runtime
44
44
  prerelease: false
45
45
  version_requirements: !ruby/object:Gem::Requirement
@@ -47,9 +47,9 @@ dependencies:
47
47
  - - ">="
48
48
  - !ruby/object:Gem::Version
49
49
  version: 3.0.0
50
- - - "<="
50
+ - - "<"
51
51
  - !ruby/object:Gem::Version
52
- version: '7'
52
+ version: '8'
53
53
  - !ruby/object:Gem::Dependency
54
54
  name: rspec
55
55
  requirement: !ruby/object:Gem::Requirement
@@ -118,7 +118,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
118
118
  - !ruby/object:Gem::Version
119
119
  version: '0'
120
120
  requirements: []
121
- rubygems_version: 3.3.5
121
+ rubygems_version: 3.3.26
122
122
  signing_key:
123
123
  specification_version: 4
124
124
  summary: Request your Rails request