Class: Strada::Adapter::JSON
- Inherits:
-
Object
- Object
- Strada::Adapter::JSON
- Defined in:
- lib/strada/adapter/json.rb
Class Method Summary collapse
-
.from(json) ⇒ Object
将 JSON 转换为 RUBY 数据结构.
-
.to(hash) ⇒ Object
将 RUBY(HASH) 数据结构转换为 JSON.
Class Method Details
.from(json) ⇒ Object
将 JSON 转换为 RUBY 数据结构
22 23 24 |
# File 'lib/strada/adapter/json.rb', line 22 def from(json) ::JSON.load json end |
.to(hash) ⇒ Object
将 RUBY(HASH) 数据结构转换为 JSON
18 19 20 |
# File 'lib/strada/adapter/json.rb', line 18 def to(hash) ::JSON.pretty_generate hash end |