livetext 0.8.98 → 0.8.99
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/livetext.rb +26 -3
- 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: 2324f86e2e454f70a4bfd13c81e77c705a88f81a7356c4e869d2f7f84cf1bc23
|
4
|
+
data.tar.gz: 6bbdebde873af6d65ee316fe0c5d97757086db703f4232e3020ccb304bfd43d7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c6eec9a455fdd2e35f5329d588167344e8602abec10c81508ab2a83943fe73a1ffeac1408487d9035f817d5c7fa671f138b4252051ce2ceeb0bf4a13d1636988
|
7
|
+
data.tar.gz: eb712c1858390b425e3b1b61a4320ae9e1e298c2a3efc42eb9b53f398bb2b37364b890dab498ce6e9f9fb3509f6df284f47bfa8c2d34043259232e7209fa9c52
|
data/lib/livetext.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
class Livetext
|
2
|
-
VERSION = "0.8.
|
2
|
+
VERSION = "0.8.99"
|
3
3
|
Path = File.expand_path(File.join(File.dirname(__FILE__)))
|
4
4
|
end
|
5
5
|
|
@@ -31,6 +31,29 @@ class Livetext
|
|
31
31
|
attr_accessor :output # both bad solutions?
|
32
32
|
end
|
33
33
|
|
34
|
+
def self.customize(mix: [], call: [], vars: {})
|
35
|
+
obj = self.new
|
36
|
+
mix = Array(mix)
|
37
|
+
call = Array(call)
|
38
|
+
mix.each {|lib| obj.mixin(lib) }
|
39
|
+
call.each {|cmd| obj.main.send(cmd[1..-1]) } # ignores leading dot, no param
|
40
|
+
vars.each_pair {|var, val| obj._setvar(var, val.to_s) }
|
41
|
+
obj
|
42
|
+
end
|
43
|
+
|
44
|
+
def customize(mix: [], call: [], vars: {})
|
45
|
+
mix = Array(mix)
|
46
|
+
call = Array(call)
|
47
|
+
mix.each {|lib| mixin(lib) }
|
48
|
+
call.each {|cmd| @main.send(cmd[1..-1]) } # ignores leading dot, no param
|
49
|
+
vars.each_pair {|var, val| _setvar(var, val.to_s) }
|
50
|
+
self
|
51
|
+
end
|
52
|
+
|
53
|
+
def vars
|
54
|
+
Livetext::Vars.dup
|
55
|
+
end
|
56
|
+
|
34
57
|
Space = " "
|
35
58
|
Sigil = "." # Can't change yet
|
36
59
|
|
@@ -127,7 +150,7 @@ end
|
|
127
150
|
end
|
128
151
|
|
129
152
|
# EXPERIMENTAL and incomplete
|
130
|
-
def xform(*args, file: nil, text: nil, vars:
|
153
|
+
def xform(*args, file: nil, text: nil, vars: {})
|
131
154
|
case
|
132
155
|
when file && text.nil?
|
133
156
|
xform_file(file)
|
@@ -142,7 +165,7 @@ end
|
|
142
165
|
self.body
|
143
166
|
end
|
144
167
|
|
145
|
-
def xform_file(file, vars:
|
168
|
+
def xform_file(file, vars: {})
|
146
169
|
Livetext::Vars.replace(vars) unless vars.nil?
|
147
170
|
self.process_file(file)
|
148
171
|
self.body
|