livetext 0.8.98 → 0.8.99

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/livetext.rb +26 -3
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 00f683f16256558d0502dbc0a5a9011579bdfead42ad47f917a625ba3a7797bf
4
- data.tar.gz: d4d83f4c157fa9f0db83adb1d98a03b87f810e4c5ee7b38fc554d926cce8cfac
3
+ metadata.gz: 2324f86e2e454f70a4bfd13c81e77c705a88f81a7356c4e869d2f7f84cf1bc23
4
+ data.tar.gz: 6bbdebde873af6d65ee316fe0c5d97757086db703f4232e3020ccb304bfd43d7
5
5
  SHA512:
6
- metadata.gz: dbc69eef5f3b013c94c3a9bc424ca811f78bb656c2f63328b065f1ccbb9e6ad1f138dde746ab11c71ae0f459ebc52a0c5b64f4831ac8043357e01b6b30147b26
7
- data.tar.gz: d84a5d9b0c177e70163574208593248d1e4c87e252101a6a4e011e8b26369b0ddee8ca44eef3fa4c8beed0feb3581cd67570bf675305cb7a321606d03b3d2c98
6
+ metadata.gz: c6eec9a455fdd2e35f5329d588167344e8602abec10c81508ab2a83943fe73a1ffeac1408487d9035f817d5c7fa671f138b4252051ce2ceeb0bf4a13d1636988
7
+ data.tar.gz: eb712c1858390b425e3b1b61a4320ae9e1e298c2a3efc42eb9b53f398bb2b37364b890dab498ce6e9f9fb3509f6df284f47bfa8c2d34043259232e7209fa9c52
@@ -1,5 +1,5 @@
1
1
  class Livetext
2
- VERSION = "0.8.98"
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: nil)
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: nil)
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
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.8.98
4
+ version: 0.8.99
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hal Fulton