markus 4.0.11 → 4.0.12
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/markus.rb +18 -0
- data/markus.gemspec +1 -1
- data/test/change.mt_ +1 -1
- data/test/change_include_common.mt_ +1 -1
- data/test/json.mt_ +1 -0
- data/test/tc_basic_json.rb +2 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5c823580a0bb0791242cc3f0f649de84e0bff7b6
|
4
|
+
data.tar.gz: 385b569f68399d927c3e481bc6780c9ec6b39292
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 395829a6126f862295ab7f42e1daf3d118eff71468191931c79593b43d624420ede122909a4ab11f5297873fc2a1b9e0104e30b48b82582fab01c70717f3926e
|
7
|
+
data.tar.gz: 2b457501d71a7025e5f7e29eda5b448026652e5fed5fdd45bd9258b8818a70a254b2a1f185dcfa3aeccdc3a5c5f7fe30e6783a89b0bb3ed2bb551f8a8630ae14
|
data/lib/markus.rb
CHANGED
@@ -72,6 +72,24 @@ class MarkUS
|
|
72
72
|
def element_!(name=nil, *args, &blk) #{{{
|
73
73
|
__markus_method_missing name, *args, &blk
|
74
74
|
end #}}}
|
75
|
+
def value_!(val) #{{{
|
76
|
+
case val
|
77
|
+
when String
|
78
|
+
content = "\"#{val.gsub(/"/,'\\\"')}\""
|
79
|
+
when Integer, Float
|
80
|
+
content = val
|
81
|
+
else
|
82
|
+
content = "null"
|
83
|
+
end
|
84
|
+
@__markus_level += 1
|
85
|
+
if self.class.__markus_indent
|
86
|
+
@__markus_buffer << "#{" " * @__markus_level}#{content},"
|
87
|
+
else
|
88
|
+
@__markus_buffer << "#{content},"
|
89
|
+
end
|
90
|
+
@__markus_level -= 1
|
91
|
+
nil
|
92
|
+
end #}}}
|
75
93
|
def template_!(name,*args) #{{{
|
76
94
|
instance_exec *args, &self.class.__markus_templates[name]
|
77
95
|
end #}}}
|
data/markus.gemspec
CHANGED
data/test/change.mt_
CHANGED
data/test/json.mt_
CHANGED
data/test/tc_basic_json.rb
CHANGED
@@ -8,13 +8,13 @@ class TestBasicJSON < Minitest::Test
|
|
8
8
|
def test_json
|
9
9
|
s = TestJSON.new
|
10
10
|
s.__markus_indent = true
|
11
|
-
assert s.json_!(:main) == "\"from\": 1,\n\"size\": 6,\n\"query\": {\n \"filtered\": {\n \"filter\": {\n \"bool\": {\n \"must\": [\n {\n \"bool\": {\n \"should\": [\n {\n \"nested\": {\n \"path\": \"contact\",\n \"query\": {\n \"term\": {\n \"contact.durchwahl\": 1\n }\n }\n }\n },\n {\n \"nested\": {\n \"path\": \"contact\",\n \"query\": {\n \"term\": {\n \"contact.durchwahl\": \"aaa\"\n }\n }\n }\n }\n ]\n }\n }\n ]\n }\n }\n }\n}"
|
11
|
+
assert s.json_!(:main) == "\"from\": 1,\n\"size\": 6,\n\"query\": {\n \"filtered\": {\n \"filter\": {\n \"bool\": {\n \"must\": [\n {\n \"bool\": {\n \"should\": [\n \"_score\",\n {\n \"nested\": {\n \"path\": \"contact\",\n \"query\": {\n \"term\": {\n \"contact.durchwahl\": 1\n }\n }\n }\n },\n {\n \"nested\": {\n \"path\": \"contact\",\n \"query\": {\n \"term\": {\n \"contact.durchwahl\": \"aaa\"\n }\n }\n }\n }\n ]\n }\n }\n ]\n }\n }\n }\n}"
|
12
12
|
end
|
13
13
|
|
14
14
|
def test_json_noindent
|
15
15
|
s = TestJSON.new
|
16
16
|
s.__markus_indent = false
|
17
|
-
assert s.json_!(:main) == "\"from\": 1,\"size\": 6,\"query\": {\"filtered\": {\"filter\": {\"bool\": {\"must\": [{\"bool\": {\"should\": [{\"nested\": {\"path\": \"contact\",\"query\": {\"term\": {\"contact.durchwahl\": 1}}}},{\"nested\": {\"path\": \"contact\",\"query\": {\"term\": {\"contact.durchwahl\": \"aaa\"}}}}]}}]}}}}"
|
17
|
+
assert s.json_!(:main) == "\"from\": 1,\"size\": 6,\"query\": {\"filtered\": {\"filter\": {\"bool\": {\"must\": [{\"bool\": {\"should\": [\"_score\",{\"nested\": {\"path\": \"contact\",\"query\": {\"term\": {\"contact.durchwahl\": 1}}}},{\"nested\": {\"path\": \"contact\",\"query\": {\"term\": {\"contact.durchwahl\": \"aaa\"}}}}]}}]}}}}"
|
18
18
|
end
|
19
19
|
|
20
20
|
def test_json_arguments
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: markus
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.0.
|
4
|
+
version: 4.0.12
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Juergen eTM Mangler
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-01-
|
11
|
+
date: 2016-01-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: minitest
|