tina4ruby 3.9.2 → 3.10.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: 101a34de44fea572c9c21c8fea286f7adfb4c34fa5227be1c82b7def86ec8d71
4
- data.tar.gz: d86ffef03c13ef707952678dde2961f9b430f81a81d7d618dd2a3c4811295611
3
+ metadata.gz: 1111e4a55512ff1a1c0c01c82e4a180d107387b687ea8caf4b0753b4207f3f02
4
+ data.tar.gz: 5abf4c9493fdaf45de25ed18f328f92595a484ec4e11b7ed1c87278a55748cb6
5
5
  SHA512:
6
- metadata.gz: 4446bf6ba80cdfb3d2ab17dabd523641f26a9eb09dbbff3cb9b6397e501206afa18bf85c1fe7b147d2aa0910ad2ca225322d7329cc6e3022ad493daee2f0e5a6
7
- data.tar.gz: d4a7c8481f75d1fce92031da88b72ac88eda029aef5ebd417010c5545429b68c8f4fffd7a9048565df0e4512bfe6a23d3a578b4b952211ef2147978c18ca31ab
6
+ metadata.gz: 91be26b34ba29c6cfe18038c3c1c78889c0723540483a663571f32482e3d6d7eff6a6fac44603627f516b21beba7f0355c656b1fce3545d6277cb294c52f027e
7
+ data.tar.gz: 56597ac885f021695f130bde7924309592e1f69154a117276c19d0ca56b2165b7a0d77fbfb79669885225976895440ee9464909f765f1d5ffce31d7ea4f13c24
data/lib/tina4/orm.rb CHANGED
@@ -2,6 +2,17 @@
2
2
  require "json"
3
3
 
4
4
  module Tina4
5
+ # Convert a snake_case name to camelCase.
6
+ def self.snake_to_camel(name)
7
+ parts = name.to_s.split("_")
8
+ parts[0] + parts[1..].map(&:capitalize).join
9
+ end
10
+
11
+ # Convert a camelCase name to snake_case.
12
+ def self.camel_to_snake(name)
13
+ name.to_s.gsub(/([A-Z])/) { "_#{$1.downcase}" }.sub(/^_/, "")
14
+ end
15
+
5
16
  class ORM
6
17
  include Tina4::FieldTypes
7
18
 
@@ -41,6 +52,15 @@ module Tina4
41
52
  @field_mapping = map
42
53
  end
43
54
 
55
+ # Auto-map flag (no-op in Ruby since snake_case is native)
56
+ def auto_map
57
+ @auto_map || false
58
+ end
59
+
60
+ def auto_map=(val)
61
+ @auto_map = val
62
+ end
63
+
44
64
  # Relationship definitions
45
65
  def relationship_definitions
46
66
  @relationship_definitions ||= {}
@@ -142,6 +142,14 @@ module Tina4
142
142
  @parent_template = nil
143
143
  end
144
144
 
145
+ # Reset context and blocks for reuse (avoids creating new instances in loops)
146
+ def reset_context(context)
147
+ @context = context
148
+ @blocks = {}
149
+ @parent_template = nil
150
+ self
151
+ end
152
+
145
153
  def render(content)
146
154
  content = process_extends(content)
147
155
  content = process_blocks(content)
@@ -226,6 +234,7 @@ module Tina4
226
234
  when Integer then (0...collection).to_a
227
235
  else []
228
236
  end
237
+ sub_engine = TwigEngine.new({}, @base_dir)
229
238
  items.each_with_index do |item, index|
230
239
  loop_context = @context.dup
231
240
  loop_context["loop"] = {
@@ -241,7 +250,7 @@ module Tina4
241
250
  else
242
251
  loop_context[key_or_val] = item
243
252
  end
244
- sub_engine = TwigEngine.new(loop_context, @base_dir)
253
+ sub_engine.reset_context(loop_context)
245
254
  output << sub_engine.render(body)
246
255
  end
247
256
  output
data/lib/tina4/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Tina4
4
- VERSION = "3.9.2"
4
+ VERSION = "3.10.1"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tina4ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.9.2
4
+ version: 3.10.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tina4 Team
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2026-03-27 00:00:00.000000000 Z
11
+ date: 2026-03-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rack