sereth_json_spec 1.0beta1 → 1.0beta2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/sereth_json_spec/api.rb +9 -4
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d91f53ee69673463cb82eb96ba77a8b04c5a34e1
4
- data.tar.gz: c5deca35e2b055c162ff67bd519004ee9afe58da
3
+ metadata.gz: e374b066323d37b41a52a52fe25e24ba7cd8bcef
4
+ data.tar.gz: 7a4aada212c66cf0257e995e8cf3920e375b2f84
5
5
  SHA512:
6
- metadata.gz: 496e9738522aca5a13174a736247b9c18afa06fbf87886229d5cd53b6b19c87cefc71166307bc6b8cc37976cea4a856f4a79c62c04f15031f4e4662d8767f38f
7
- data.tar.gz: c93d872c3231b3b7edbe68ecf56746c5e620bcc8ff708dc86b20dfd866dc490657df5bfca3031b33522d3cf046b6bd0e1a7fd8fe997702ad55de372ac4094cdb
6
+ metadata.gz: bf7b61af52b0e20064516ae1c2efe8414829059f0506a4e492694c30990f693b1e04064b590485d6e0662620155d8baa35b6f2af318cfb0fbc9e4d8beeb8168d
7
+ data.tar.gz: 485787383251f7ffb662f082207abe655cf2df29096fd945a93296131c304aec6602e42c491b877aa0d385af51984ee0256f9a2f8979a6b427c870a70cb1012c
@@ -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(options = {})
39
- if options.has_key?(:spec)
40
- Data.export(self.class.json_spec_path, options[:spec], self)
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.0beta1
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-27 00:00:00.000000000 Z
11
+ date: 2013-02-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake