Class: LLM::JSONAdapter::JSON
- Inherits:
-
LLM::JSONAdapter
- Object
- LLM::JSONAdapter
- LLM::JSONAdapter::JSON
- Defined in:
- lib/llm/json_adapter.rb
Overview
The LLM::JSONAdapter::JSON class provides a JSON adapter backed by the standard library JSON module.
Class Method Summary collapse
Class Method Details
.dump(obj, state = nil, **options) ⇒ Object
38 39 40 41 42 43 44 45 46 47 |
# File 'lib/llm/json_adapter.rb', line 38 def self.dump(obj, state = nil, **) require "json" unless defined?(::JSON) if ::JSON::State === state ::JSON.generate(obj, state) elsif state ::JSON.dump(obj, state, **) else ::JSON.dump(obj, **) end end |