livetext 0.9.62 → 0.9.64

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: 61c11b22070e565c5c25735ea1134d58249a5f441f0ed3c1f9eeb0f8bbf7c628
4
- data.tar.gz: feff45c934b1ecb8757dcd1ea3fad4947e7383063faa9f3f68506dc73c99ff9e
3
+ metadata.gz: 668ebd888cc8329fa00934cb05b47ed599c2f22910e4c2691350c9d5e05e20f0
4
+ data.tar.gz: 39c26ca4ac7eea09f1fecc984a1f4c14575c49cc265a7ebb07d9842cc951be7f
5
5
  SHA512:
6
- metadata.gz: 6e9fa6aeec991337d703e223f20daef4b65b0d261be3cdcfbce99854ab263c0660e2288de725411ba3eaa29c1e8e65ae421dddd433c187e813b10b052f658f1b
7
- data.tar.gz: f899d4de12921521b8d06adb35d10ed1f530cab3f9bc1d8c665ddb9bd7eb54b397d6bf7bc0a8686ecdfbd71a9aba18b470da0da38f2687d09ca03ba662b30f7b
6
+ metadata.gz: d15b35fe3fe416bfa699349ec4e998c951e58db1e4ecf98ad9046e44e80fa8cec7c403543de8aaf578e881e48827d1934769d085b8adc706fed6f6fcc46cbd17
7
+ data.tar.gz: 47912d143d7f83e63a36a2a087b82840b2b5742ea2ef747dd325e993a89d6eeab136c085f88f047c7854d4b7b407ccabee24e80afc290d417747d5360da180c4
@@ -59,6 +59,8 @@ class Livetext::Expansion
59
59
  if result.start_with?("[Error evaluating $$#{name}(")
60
60
  # Try old Livetext::Functions system
61
61
  fobj = ::Livetext::Functions.new
62
+ # Set api on Livetext::Functions so functions can access it
63
+ Livetext::Functions.api = @live.api
62
64
  old_result = fobj.send(name, param) rescue nil
63
65
  return old_result.to_s if old_result
64
66
 
@@ -20,6 +20,11 @@ class Livetext::Functions
20
20
  @vars = nil
21
21
  end
22
22
 
23
+ # Simple method to access the class variable
24
+ def api
25
+ self.class.api
26
+ end
27
+
23
28
  # Helper method to access variables with fallback to global Livetext::Vars
24
29
  def get_var(name)
25
30
  return @vars.get(name) if @vars
@@ -2,5 +2,5 @@
2
2
  # Defining VERSION
3
3
 
4
4
  class Livetext
5
- VERSION = "0.9.62"
5
+ VERSION = "0.9.64"
6
6
  end
@@ -4,7 +4,7 @@
4
4
  4 /<p>Directory: .*livetext.*</p>/
5
5
  5 <p>Platform: universal.x86_64-darwin22</p>
6
6
  6 <p>Ruby version: 2.6.10</p>
7
- 7 <p>Livetext version: 0.9.61</p>
7
+ 7 /<p>Livetext version: \d+\.\d+\.\d+<\/p>/
8
8
  8 <p>Reverse of 'hello': olleh</p>
9
9
  9 <p>Square root of 16: 4</p>
10
10
  10 /<p>Random \(1-10\): \d+</p>/
@@ -3,7 +3,7 @@
3
3
  3 Hostname: HAL9000
4
4
  4 /Platform: .*x86_64-darwin\d+/
5
5
  5 /Ruby Version: \d+\.\d+\.\d+/
6
- 6 Livetext Version: 0.9.61
6
+ 6 /Livetext Version: \d+\.\d+\.\d+/
7
7
  7 </p>
8
8
  8
9
9
  9 <p>
@@ -31,8 +31,8 @@ class TestFunctionAPIAccess < Minitest::Test
31
31
  Livetext::Functions.class_eval do
32
32
  def test_asset_function(param)
33
33
  # This mimics the asset function from Scriptorium that needs api.vars
34
- vname = self.class.api.vars.to_h[:View]
35
- postid = self.class.api.vars.to_h[:"post.id"]
34
+ vname = api.vars.to_h[:View]
35
+ postid = api.vars.to_h[:"post.id"]
36
36
  "view=#{vname}, post=#{postid}, file=#{param}"
37
37
  end
38
38
  end
@@ -47,8 +47,8 @@ class TestFunctionAPIAccess < Minitest::Test
47
47
  # Define a function that needs access to api.vars but takes no parameters
48
48
  Livetext::Functions.class_eval do
49
49
  def test_view_info
50
- vname = self.class.api.vars.to_h[:View]
51
- postid = self.class.api.vars.to_h[:"post.id"]
50
+ vname = api.vars.to_h[:View]
51
+ postid = api.vars.to_h[:"post.id"]
52
52
  "view=#{vname}, post=#{postid}"
53
53
  end
54
54
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: livetext
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.62
4
+ version: 0.9.64
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hal Fulton