tina4ruby 3.10.65 → 3.10.67

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: a6fa463a9244bec2d1144ebcdc903e19681ea7e60cc0b3ea3438e21b8388ec9e
4
- data.tar.gz: 3ac6566d7b754979331b290e9c3610778eaa69ce6c31ae0eb8d8b16dd69deaa5
3
+ metadata.gz: e5ba81bb86f837e23521b7b13d2ee313a0ac7e34bbf04371c4256d00b077c7f3
4
+ data.tar.gz: 9bb8a43825801b904b30bddcfbc51fedc74694bb04d37d404d33702338d40806
5
5
  SHA512:
6
- metadata.gz: c40fcd4bc17ee1e0d2e41a297750210fc1e66708080a20c180dfe2f6338ce435d8e30042c0799a9455384b5808f221c00f156d13bdbd9aac4ecbbd655d9204fa
7
- data.tar.gz: 180229e03f54704f3d3455d6b1c6690aea1979fbcbbfe2b05150c1831b25630628cbeb3b52cb7810f72939d9360e40d4a0ff8c42196df46591114aa923ea1e74
6
+ metadata.gz: 29819ac550ac637dbc6bd3fb3456e426a2311cdbabc6cbe9953d4b03317ecb5eca6f55f5f70b69f515db433135b221fb45320f7aad3ded354b56a9772f150da2
7
+ data.tar.gz: 2ae5fc934297b48c3352aab9bc6606dba1553adc91e989efe8b301a6163e291eeec9f79d592a2a781ea34528b13b75a6cf8d55714f4795b5da80984c9be6e165
data/lib/tina4/metrics.rb CHANGED
@@ -21,6 +21,9 @@ module Tina4
21
21
  @full_cache_time = 0
22
22
  CACHE_TTL = 60
23
23
 
24
+ # Stores the resolved scan root so file_detail can locate framework files.
25
+ @last_scan_root = ""
26
+
24
27
  # ── Root Resolution ──────────────────────────────────────────
25
28
 
26
29
  # Pick the right directory to scan.
@@ -30,10 +33,17 @@ module Tina4
30
33
  def self._resolve_root(root = 'src')
31
34
  root_path = Pathname.new(root)
32
35
  if root_path.directory? && !Dir.glob(root_path.join('**', '*.rb')).empty?
36
+ @last_scan_root = File.expand_path(root)
33
37
  return root
34
38
  end
35
39
  # Fallback: scan the framework package itself
36
- File.dirname(__FILE__)
40
+ fw_dir = File.dirname(__FILE__)
41
+ @last_scan_root = fw_dir
42
+ fw_dir
43
+ end
44
+
45
+ def self.last_scan_root
46
+ @last_scan_root
37
47
  end
38
48
 
39
49
  # ── Quick Metrics ───────────────────────────────────────────
@@ -346,6 +356,15 @@ module Tina4
346
356
  # ── File Detail ─────────────────────────────────────────────
347
357
 
348
358
  def self.file_detail(file_path)
359
+ unless File.exist?(file_path)
360
+ # Try resolving relative to the last scan root (framework mode)
361
+ if @last_scan_root && !@last_scan_root.empty?
362
+ candidate = File.join(@last_scan_root, file_path)
363
+ if File.exist?(candidate)
364
+ file_path = candidate
365
+ end
366
+ end
367
+ end
349
368
  unless File.exist?(file_path)
350
369
  return { "error" => "File not found: #{file_path}" }
351
370
  end
data/lib/tina4/orm.rb CHANGED
@@ -481,29 +481,15 @@ module Tina4
481
481
  errors
482
482
  end
483
483
 
484
- def load(filter_sql = nil, params = [])
485
- @relationship_cache = {} # Clear relationship cache on reload
486
-
487
- pk = self.class.primary_key_field || :id
488
-
489
- # Determine the SQL to execute
490
- if filter_sql.nil? || filter_sql.is_a?(Integer)
491
- # Legacy: load by primary key (load() or load(id))
492
- id = filter_sql || __send__(pk)
493
- return false unless id
494
- sql = "SELECT * FROM #{self.class.table_name} WHERE #{pk} = ?"
495
- query_params = [id]
496
- else
497
- # Filter-based: load("email = ?", ["alice@example.com"])
498
- sql = "SELECT * FROM #{self.class.table_name} WHERE #{filter_sql}"
499
- query_params = params
500
- end
501
-
502
- result = self.class.db.fetch_one(sql, query_params)
484
+ # Load a record into this instance via select_one.
485
+ # Returns true if found and loaded, false otherwise.
486
+ def load(sql, params = [], include: nil)
487
+ @relationship_cache = {}
488
+ result = self.class.select_one(sql, params, include: include)
503
489
  return false unless result
504
490
 
505
491
  mapping_reverse = self.class.field_mapping.invert
506
- result.each do |key, value|
492
+ result.to_h.each do |key, value|
507
493
  attr_name = mapping_reverse[key.to_s] || key
508
494
  setter = "#{attr_name}="
509
495
  __send__(setter, value) if respond_to?(setter)
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.10.65"
4
+ VERSION = "3.10.67"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tina4ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.10.65
4
+ version: 3.10.67
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tina4 Team