livetext 0.9.62 → 0.9.63
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 +4 -4
- data/lib/livetext/functions.rb +5 -0
- data/lib/livetext/version.rb +1 -1
- data/test/unit/function_api_access.rb +4 -4
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bb39ca81affae7c276e894251b5d69c330a17245c2f364c1fa0841d24e5debba
|
4
|
+
data.tar.gz: fbbf80f992676e11185b7c498161763e38caf77dee3bddac4de256d729455334
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 72b78214a3b7b0e9f3653382500374af525c2b5bc0ce606c0cf11fb935b9eb8b4252d485796359e27d65dd1f1d1d1017ee43e71681c0b56d94db686c7953a547
|
7
|
+
data.tar.gz: 4ca59582edf8676cb9265f82ddaec1cd921ee572016e28a4c11b2db522c977a85ae06c233f065c11c5287a126e6a8c29a5b1699450bd808505a87efc62be1018
|
data/lib/livetext/functions.rb
CHANGED
@@ -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
|
data/lib/livetext/version.rb
CHANGED
@@ -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 =
|
35
|
-
postid =
|
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 =
|
51
|
-
postid =
|
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
|