sereth_json_spec 1.0beta1 → 1.0beta2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/sereth_json_spec/api.rb +9 -4
- 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: e374b066323d37b41a52a52fe25e24ba7cd8bcef
|
4
|
+
data.tar.gz: 7a4aada212c66cf0257e995e8cf3920e375b2f84
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bf7b61af52b0e20064516ae1c2efe8414829059f0506a4e492694c30990f693b1e04064b590485d6e0662620155d8baa35b6f2af318cfb0fbc9e4d8beeb8168d
|
7
|
+
data.tar.gz: 485787383251f7ffb662f082207abe655cf2df29096fd945a93296131c304aec6602e42c491b877aa0d385af51984ee0256f9a2f8979a6b427c870a70cb1012c
|
data/lib/sereth_json_spec/api.rb
CHANGED
@@ -34,10 +34,15 @@ module Sereth::JsonSpec
|
|
34
34
|
end
|
35
35
|
|
36
36
|
# Export item as JSON of a given spec. An invalid spec will generate
|
37
|
-
# an exception
|
38
|
-
def to_json(
|
39
|
-
if
|
40
|
-
Data.export(self.class.json_spec_path,
|
37
|
+
# an exception. Will optionally extra-escape data for inclusion in initial template.
|
38
|
+
def to_json(_ = {}, spec: nil, escape: false)
|
39
|
+
if spec
|
40
|
+
ret = Data.export(self.class.json_spec_path, spec, self)
|
41
|
+
if escape
|
42
|
+
ret = ret.to_json
|
43
|
+
ret = ret.html_safe if ret.responds_to?(:html_safe)
|
44
|
+
end
|
45
|
+
return ret
|
41
46
|
elsif defined?(super)
|
42
47
|
super
|
43
48
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sereth_json_spec
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.0beta2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tikhon Botchkarev
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-03
|
11
|
+
date: 2013-02-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|