Class: Vedeu::Renderers::JSON Private
- Includes:
- Options
- Defined in:
- lib/vedeu/renderers/json.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Renders a Buffers::Terminal as JSON.
Instance Attribute Summary
Attributes included from Options
Instance Method Summary collapse
- #as_hash ⇒ Array private private
-
#clear ⇒ Hash
private
Render a cleared output.
- #content ⇒ String private private
Methods included from Options
#compression, #compression?, #default_template, #defaults, #end_row_tag, #end_tag, #filename, #initialize, #output, #output?, #render, #start_row_tag, #start_tag, #template, #timestamp, #timestamp?, #write, #write_file, #write_file?
Methods included from Common
#absent?, #array?, #boolean, #boolean?, #empty_value?, #escape?, #falsy?, #hash?, #line_model?, #numeric?, #positionable?, #present?, #snake_case, #stream_model?, #string?, #symbol?, #truthy?, #view_model?
Methods inherited from File
Instance Method Details
#as_hash ⇒ Array (private)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
25 26 27 |
# File 'lib/vedeu/renderers/json.rb', line 25 def as_hash output.content.map(&:to_h) end |
#clear ⇒ Hash
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Render a cleared output.
18 19 20 |
# File 'lib/vedeu/renderers/json.rb', line 18 def clear render({}) end |
#content ⇒ String (private)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/vedeu/renderers/json.rb', line 30 def content if hash?(output) ::JSON.pretty_generate(output) else Vedeu.log(type: :render, message: "#{self.class.name}#content: #{output.class.name}") ::JSON.pretty_generate(as_hash) end end |