theo-rails 0.4.2 → 0.4.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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/theo-rails/theo.rb +15 -0
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d68c72000b96eb18b922857ea9b124e6a89b7cb4f75951aadba76b6985e54359
4
- data.tar.gz: 2193398331d9f5b355d1311adee6cef60174e063ee41cf878e36b9dba4dd1f6f
3
+ metadata.gz: 779505977e5af5380369d5e341216d3a89b32ebb08c92a622e1204d837fb8c6f
4
+ data.tar.gz: e9d63d6efb0014f5af7a552c35dfc31b6e769f22c3a13c815da3b4d47d05f744
5
5
  SHA512:
6
- metadata.gz: b6a4513fd9cf350712f152d47f7173d0511e013d59ff75c4319ad8056504e619c3d99171abe0fbe951b5a44cce73767e9778fa66e3747c9956ed94154f518659
7
- data.tar.gz: fa5bbac608e04e4a3daee6a46d51a3c9e718d2b08d2c8cf8af1d3f87e3886119e286c4dae1fedf04526d7275f0e3df76b597d54895b9117047d794a13d42b69e
6
+ metadata.gz: 6ae0efd45f92b7966957f637ee3b31409e7f1093bc52005be75c9cf1787e37af1bd1307967aed05b02a6407b73b21ec3b5d81f9335a3767fe81099bfb6cc7b50
7
+ data.tar.gz: 239d3f58793e9f638b457e5cb2740ffd19566619a1213b99af7c14a9f1393ab63105c0920a8e828b6ebd11c77edc0485aa25aa587d66c16af08b1975c59a2c1b
@@ -114,6 +114,21 @@ module Theo
114
114
  is_capitalized && Object.const_defined?("#{component}Component")
115
115
  end
116
116
 
117
+ def translate_location(spot, backtrace_location, source)
118
+ result = ActionView::Template::Handlers::ERB.new.translate_location(spot, backtrace_location, source)
119
+
120
+ return unless result.nil?
121
+
122
+ # TODO: More precise location handling, see ERB::Util for inspiration
123
+ lineno_delta = ActionView::Base.annotate_rendered_view_with_filenames ? 1 : 0
124
+ spot[:first_lineno] -= lineno_delta
125
+ spot[:last_lineno] -= lineno_delta
126
+ spot[:first_column] = 0
127
+ spot[:last_column] = 0
128
+ spot[:script_lines] = source.lines
129
+ spot
130
+ end
131
+
117
132
  def call(template, source = nil)
118
133
  theo = process(source)
119
134
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: theo-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.2
4
+ version: 0.4.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jarek Lipski
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-10-26 00:00:00.000000000 Z
11
+ date: 2024-10-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport