mote 1.2.0 → 1.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/LICENSE +1 -1
- data/lib/mote.rb +8 -6
- data/mote.gemspec +0 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cdd4825c5458059af60c35d0a45e2d9efec430f8
|
4
|
+
data.tar.gz: 2f454858806c6d3843cd1633fd08f87ab964032e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 801c98128e08fcf1ff39c063298bd4b62441d61fbadf909a540a4af28ef81c2457e1e7066e88b41eaf7fd8f0e03693ee9e888d67ffd4b942c6e10b3eb6da48d7
|
7
|
+
data.tar.gz: 504696651e81f5b179039167fe424e0bd5f191dadaf1c26a37d38594f1d8af2ec8518975def4711509c88a81ca547b201507b91e660258cf38b489fd360f10e5
|
data/LICENSE
CHANGED
data/lib/mote.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (c) 2011
|
1
|
+
# Copyright (c) 2011 Michel Martens
|
2
2
|
#
|
3
3
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
4
4
|
# of this software and associated documentation files (the "Software"), to deal
|
@@ -18,17 +18,17 @@
|
|
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.
|
21
|
+
VERSION = "1.3.0"
|
22
22
|
|
23
|
-
# The regex
|
24
|
-
#
|
23
|
+
# The regex has three alternative blocks that capture the embedded
|
24
|
+
# Ruby code. The rest is left as is.
|
25
25
|
PATTERN = /
|
26
26
|
^[^\S\n]*(%)[^\S\n]*(.*?)(?:\n|\Z) | # Ruby evaluated lines
|
27
27
|
(<\?)\s+(.*?)\s+\?> | # Multiline Ruby blocks
|
28
28
|
(\{\{)(.*?)\}\} # Ruby evaluated to strings
|
29
29
|
/mx
|
30
30
|
|
31
|
-
def self.
|
31
|
+
def self.src(template, vars = [])
|
32
32
|
terms = template.split(PATTERN)
|
33
33
|
|
34
34
|
code = "Proc.new do |params, __o| params ||= {}; __o ||= '';"
|
@@ -47,8 +47,10 @@ class Mote
|
|
47
47
|
end
|
48
48
|
|
49
49
|
code << "__o; end"
|
50
|
+
end
|
50
51
|
|
51
|
-
|
52
|
+
def self.parse(template, context = self, vars = [], name = "template")
|
53
|
+
context.instance_eval(src(template, vars), name, -1)
|
52
54
|
end
|
53
55
|
|
54
56
|
module Helpers
|
data/mote.gemspec
CHANGED
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.
|
4
|
+
version: 1.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michel Martens
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-08-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: cutest
|
@@ -58,7 +58,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
58
58
|
version: '0'
|
59
59
|
requirements: []
|
60
60
|
rubyforge_project:
|
61
|
-
rubygems_version: 2.
|
61
|
+
rubygems_version: 2.6.11
|
62
62
|
signing_key:
|
63
63
|
specification_version: 4
|
64
64
|
summary: Minimum Operational Template.
|