meta_request 0.8.2 → 0.8.3

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: b114549ece75d9a5183a87f457952e0d103adcce4c784352911a231151020d24
4
- data.tar.gz: 80f5f7204225754b2ad60743f1eacceb7f49558a810b2dfbfef1ce53ce6f3161
3
+ metadata.gz: 108596676b5e12bbd5e63c1f7b9ad5ccaf62b435fe8d21a959a30d876c3a6ba1
4
+ data.tar.gz: 496eba3a8c6d7d85897e2a0230ce23addee87c597d00fd0e11959697c1844d05
5
5
  SHA512:
6
- metadata.gz: 8f406ad978c33a6a75d0651a32e863950efd14c6d89695bb89f52a3b31d7e5b962266cb1d3b1817736f991b122745cd0affd1c519e04270f1284433626560d79
7
- data.tar.gz: 1955bceb15a0c34c42990e3177db492579550fc4c343eed6df62db08bd80e5dc99963773ca10989ff89f7125dcc7b3e7394a7a8ab344d6350e110d502bb69b4f
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.2
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
@@ -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