twig_ruby 0.0.5 → 0.0.6

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: 4e727b10dc2226c2da43a9a2b8e1cd4a2e1b5a18ffb16eca116611b0d0f307cf
4
- data.tar.gz: ef48d56a8bef43bd999cd17dc3def1371b58c12e4fba6c6bb143ba8b21dba6c4
3
+ metadata.gz: 2a2cec3c9f7ff1aee90cc8728a14a711376ecfb5c0dcad92d02bd4e25a926a91
4
+ data.tar.gz: dca954724b75bea4b3ed372371791e2cdc16d6f1e8a6429d876e4d5e14ed34f4
5
5
  SHA512:
6
- metadata.gz: 1cbec5dd395ca0c306ab6eee643aa5954e46cd3181985e55fac994a2eecbdc4473aaba91a344e9681ad1aa28be3e77980461da775a740e908ec2dbb2fdbf73dc
7
- data.tar.gz: fa32c024631b8cb528fb35463422b09e8b461ed75c1ef440bc4ccd8268686d928bcad868a82b9f98d5621a1e99047b2c4949589d7d967de23bcdf4ebe2b192ad
6
+ metadata.gz: cdaf2674839c428dc0a784c4173407d89ddce53027342a33c81ca550335ea9bbc3b4c609ded535d8249eed06f2d45e3d544f4419cf9e303b2c51a9f8fe08e197
7
+ data.tar.gz: 69dab9d2e128182be3d75a1948d3c4c1cc79b392121ce87c091bae7fa1c52c5fe7ec123102d85615eb2430ffa1454b158ab25139e9f5a55d8639bb4a18becb96
@@ -256,7 +256,7 @@ class TwigFixture
256
256
  templates = {}
257
257
  test.scan(/--TEMPLATE(?:\((.*?)\))?--(.*?)(?=--TEMPLATE|\z)/mx).map do |name, contents|
258
258
  templates[name || 'index.twig'] = contents.
259
- gsub(/[\n]*\z/, '').
259
+ gsub(/\n*\z/, '').
260
260
  gsub('d/m/Y H:i:s P', '%d/%m/%Y %H:%M:%S %:z'). # Change dates to Ruby format
261
261
  gsub('Twig\Tests\TwigTestFoo', 'TwigTestFoo') # Change class name to match Ruby
262
262
  end
@@ -880,11 +880,11 @@ module Twig
880
880
  return object[attribute] || (attribute.is_a?(String) ? object[attribute.to_sym] : object[attribute.to_s])
881
881
  end
882
882
 
883
- if defined_test
884
- return false
885
- end
886
-
887
883
  if type == Template::ARRAY_CALL
884
+ if defined_test
885
+ return false
886
+ end
887
+
888
888
  if ignore_strict_check || !environment.strict_variables?
889
889
  return
890
890
  end
@@ -893,7 +893,13 @@ module Twig
893
893
  end
894
894
  end
895
895
 
896
- if object.respond_to?(attribute)
896
+ responds_to = begin
897
+ object.respond_to?(attribute)
898
+ rescue StandardError
899
+ false
900
+ end
901
+
902
+ if responds_to
897
903
  if defined_test
898
904
  return true
899
905
  end
@@ -933,7 +939,7 @@ module Twig
933
939
  end
934
940
  end
935
941
  # Constant could be nil but we should return if we find it
936
- elsif (constant = get_constant(object, attribute)) && constant[0] == :found
942
+ elsif (constant = get_constant(object, attribute.to_s)) && constant[0] == :found
937
943
  constant[1]
938
944
  else
939
945
  return if ignore_strict_check || !environment.strict_variables?
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: twig_ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Craig Blanchette
8
8
  - Fabian Potencier
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-08-05 00:00:00.000000000 Z
11
+ date: 2025-09-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport