Class: Coradoc::Mirror::Output::MirrorJson
- Inherits:
-
Object
- Object
- Coradoc::Mirror::Output::MirrorJson
- Defined in:
- lib/coradoc/mirror/output.rb
Overview
JSON output processor for the Coradoc::Output pipeline.
Class Method Summary collapse
- .processor_execute(input, options = {}) ⇒ Object
- .processor_id ⇒ Object
- .processor_match?(filename) ⇒ Boolean
Class Method Details
.processor_execute(input, options = {}) ⇒ Object
25 26 27 28 29 30 31 |
# File 'lib/coradoc/mirror/output.rb', line 25 def processor_execute(input, = {}) pretty = [:pretty] != false input.each_with_object({}) do |(filename, document), result| node = Coradoc::Mirror.transform(document) result[filename] = pretty ? JSON.pretty_generate(node.to_hash) : JSON.generate(node.to_hash) end end |
.processor_id ⇒ Object
17 18 19 |
# File 'lib/coradoc/mirror/output.rb', line 17 def processor_id :mirror_json end |
.processor_match?(filename) ⇒ Boolean
21 22 23 |
# File 'lib/coradoc/mirror/output.rb', line 21 def processor_match?(filename) filename.downcase.end_with?('.mirror.json') end |