factbase 0.9.9 → 0.9.10

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: 72ae2c1184dfd8ab966591846cd054c3155b0536d8c7f2f7acf636df1eb7e045
4
- data.tar.gz: fcf929766bf80cc040744ce9caa719503548fac719d956f676e9604374d78b8c
3
+ metadata.gz: eda6e3c356b973e7cb4ce6c10d709a94a7e5f390168a3e72818ce57b705401ac
4
+ data.tar.gz: 6e9712aea64f66a65fe8870213889576ab510c908f413bc84f3b1c9c352ecc04
5
5
  SHA512:
6
- metadata.gz: 0d6c3b87fd94afe4fc7984ca17be09ffd6dbff5d93951e264720201e2e5680e387fc0215331af563af7cc78ac3db9e199ca8a0aadc39d989fb377b975d3e1b8d
7
- data.tar.gz: 26c9ffe593d79fc17d80949208cc0833d4147684a0fcd221dc6abd669c545da678dc4fd52723913bc29a68662ca43cf7470a9523022d0919af6dd42a440d69ca
6
+ metadata.gz: 33032268ae5f9be44b9360234960efd89bdc424d65e21543d75a50a95f9fe0628608319e29719ac836b72f0592b362fc3792e2fc364233ef73593f6111c22eb6
7
+ data.tar.gz: c7e3621f05a28492e8c756d44ecd5312aea97e0d7990d08408d5d30d481bbd76bb28615f78be44ac7875508133961d200b677a887c9b129b8c7dad425348d96b
@@ -46,7 +46,7 @@ class Factbase::Accum
46
46
  vv.uniq!
47
47
  vv.empty? ? nil : vv
48
48
  elsif @props[k].nil?
49
- @fact.method_missing(*args)
49
+ @fact.public_send(*args)
50
50
  else
51
51
  @props[k][0]
52
52
  end
data/lib/factbase/tee.rb CHANGED
@@ -38,7 +38,7 @@ class Factbase::Tee
38
38
  r = [r] unless r.respond_to?(:each) || r.nil?
39
39
  r
40
40
  else
41
- @fact.send(*args)
41
+ @fact.public_send(*args)
42
42
  end
43
43
  end
44
44
  end
data/lib/factbase.rb CHANGED
@@ -82,7 +82,7 @@ require 'yaml'
82
82
  # License:: MIT
83
83
  class Factbase
84
84
  # Current version of the gem (changed by .rultor.yml on every release)
85
- VERSION = '0.9.9' unless const_defined?(:VERSION)
85
+ VERSION = '0.9.10' unless const_defined?(:VERSION)
86
86
 
87
87
  # An exception that may be thrown in a transaction, to roll it back.
88
88
  class Rollback < StandardError; end
@@ -8,6 +8,10 @@ require_relative '../../lib/factbase'
8
8
  require_relative '../../lib/factbase/accum'
9
9
  require_relative '../../lib/factbase/fact'
10
10
 
11
+ def global_function_for_this_test_only(foo)
12
+ raise foo
13
+ end
14
+
11
15
  # Accum test.
12
16
  # Author:: Yegor Bugayenko (yegor256@gmail.com)
13
17
  # Copyright:: Copyright (c) 2024-2025 Yegor Bugayenko
@@ -24,6 +28,14 @@ class TestAccum < Factbase::Test
24
28
  assert_equal([42], props['foo'])
25
29
  end
26
30
 
31
+ def test_fetches_without_conflict_with_global_name
32
+ t = Factbase::Accum.new(
33
+ Factbase::Fact.new({ 'global_function_for_this_test_only' => [2] }),
34
+ {}, true
35
+ )
36
+ assert_equal(2, t.global_function_for_this_test_only)
37
+ end
38
+
27
39
  def test_passes_props
28
40
  map = {}
29
41
  f = Factbase::Fact.new(map)
@@ -5,9 +5,14 @@
5
5
 
6
6
  require_relative '../test__helper'
7
7
  require_relative '../../lib/factbase'
8
+ require_relative '../../lib/factbase/accum'
8
9
  require_relative '../../lib/factbase/tee'
9
10
  require_relative '../../lib/factbase/fact'
10
11
 
12
+ def global_function_for_test_only(foo)
13
+ raise foo
14
+ end
15
+
11
16
  # Tee test.
12
17
  # Author:: Yegor Bugayenko (yegor256@gmail.com)
13
18
  # Copyright:: Copyright (c) 2024-2025 Yegor Bugayenko
@@ -30,6 +35,25 @@ class TestTee < Factbase::Test
30
35
  assert_nil(t['$foo'])
31
36
  end
32
37
 
38
+ def test_fetches_simply
39
+ t = Factbase::Accum.new(
40
+ Factbase::Tee.new(
41
+ Factbase::Fact.new({ 'foo_bar' => [987] }),
42
+ Factbase::Fact.new({})
43
+ ),
44
+ {}, true
45
+ )
46
+ assert_equal(987, t.foo_bar)
47
+ end
48
+
49
+ def test_fetches_without_conflict_with_global_name
50
+ t = Factbase::Tee.new(
51
+ Factbase::Fact.new({ 'global_function_for_test_only' => [2] }),
52
+ Factbase::Fact.new({})
53
+ )
54
+ assert_equal(2, t.global_function_for_test_only)
55
+ end
56
+
33
57
  def test_all_properties
34
58
  prim = Factbase::Fact.new({})
35
59
  prim.foo = 42
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: factbase
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.9
4
+ version: 0.9.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yegor Bugayenko