Module: LogMagic::JSONUtils
- Included in:
- BaseExplainer, SearchkickExplainer::QueryExplainerSection, SearchkickExplainer::SettingsExplainerSection
- Defined in:
- lib/log_magic/utils/json_utils.rb
Instance Method Summary collapse
Instance Method Details
#parse_json(json) ⇒ Object
8 9 10 |
# File 'lib/log_magic/utils/json_utils.rb', line 8 def parse_json(json) JSON.parse(json) end |
#pretty_print_json(json) ⇒ Object
2 3 4 5 6 |
# File 'lib/log_magic/utils/json_utils.rb', line 2 def pretty_print_json(json) JSON.pretty_generate(parse_json(json)) .gsub("\n", '<br>') .gsub(" ", ' ') end |
#query_hash ⇒ Object
12 13 14 |
# File 'lib/log_magic/utils/json_utils.rb', line 12 def query_hash JSON.parse(query_json) end |