mote 1.3.0 → 1.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/lib/mote.rb +3 -3
- data/test/mote_test.rb +8 -0
- metadata +3 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 505a571d37072d62d6a1de88ef80388861411beb832dee8a959a0aaf44250b3c
|
4
|
+
data.tar.gz: e71a2d24a0f66ad9d12e006114b0c3ab8c2e2d0f08c945e76042aa6bd1ab3505
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 41df91b9f277c509c6b5d438ac7039f07e5265889e58e8235d8d630bd4db7c263e2a9406776b691b86e0310736da1c3b91cff1d84d0b3cad86723844748d81b7
|
7
|
+
data.tar.gz: 1587c00e41e9bfeaf5a180b8297e3fb1f84e097c0c2d432fa2b2f86e7e7b4da921ab3919ced687d954733bcfaad5a6c028ea12000f52453ef9db0d4f8e721f89
|
data/lib/mote.rb
CHANGED
@@ -18,7 +18,7 @@
|
|
18
18
|
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19
19
|
# THE SOFTWARE.
|
20
20
|
class Mote
|
21
|
-
VERSION = "1.3.
|
21
|
+
VERSION = "1.3.1"
|
22
22
|
|
23
23
|
# The regex has three alternative blocks that capture the embedded
|
24
24
|
# Ruby code. The rest is left as is.
|
@@ -49,8 +49,8 @@ class Mote
|
|
49
49
|
code << "__o; end"
|
50
50
|
end
|
51
51
|
|
52
|
-
def self.parse(
|
53
|
-
|
52
|
+
def self.parse(_template, _context = self, _vars = [], _name = "template")
|
53
|
+
_context.instance_eval(src(_template, _vars), _name, -1)
|
54
54
|
end
|
55
55
|
|
56
56
|
module Helpers
|
data/test/mote_test.rb
CHANGED
@@ -90,6 +90,14 @@ scope do
|
|
90
90
|
example = Mote.parse("{{ user }}", context)
|
91
91
|
assert_equal "Bruno", example.call
|
92
92
|
end
|
93
|
+
|
94
|
+
test "context with name" do
|
95
|
+
context = Object.new
|
96
|
+
def context.name; "Sebas"; end
|
97
|
+
|
98
|
+
example = Mote.parse("{{ self.name }}", context)
|
99
|
+
assert_equal "Sebas", example.call
|
100
|
+
end
|
93
101
|
|
94
102
|
test "locals" do
|
95
103
|
example = Mote.parse("{{ user }}", TOPLEVEL_BINDING, [:user])
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mote
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.3.
|
4
|
+
version: 1.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michel Martens
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-04-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: cutest
|
@@ -57,8 +57,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
57
57
|
- !ruby/object:Gem::Version
|
58
58
|
version: '0'
|
59
59
|
requirements: []
|
60
|
-
|
61
|
-
rubygems_version: 2.6.11
|
60
|
+
rubygems_version: 3.0.3
|
62
61
|
signing_key:
|
63
62
|
specification_version: 4
|
64
63
|
summary: Minimum Operational Template.
|