Sha256: f568c7d47408b48c571a01437a6d66fc47f9a596e885af6d65e743f0e0a7968c
Contents?: true
Size: 532 Bytes
Versions: 3
Compression:
Stored size: 532 Bytes
Contents
# frozen_string_literal: true class Strada def to_json(config) Adapter::JSON.to config._config_to_hash end def from_json(json) Adapter::JSON.from json end class Adapter class JSON # 定义类方法 class << self require "json" # 将 RUBY(HASH) 数据结构转换为 JSON def to(hash) ::JSON.pretty_generate hash end # 将 JSON 转换为 RUBY 数据结构 def from(json) ::JSON.load json end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
strada-0.0.3 | lib/strada/adapter/json.rb |
strada-0.0.2 | lib/strada/adapter/json.rb |
strada-0.0.1 | lib/strada/adapter/json.rb |