Sha256: 18c4736c7fd1c4ffbd445de47d43b3733e2920eb772412e34f4a16ee64939fa7
Contents?: true
Size: 804 Bytes
Versions: 3
Compression:
Stored size: 804 Bytes
Contents
require 'pdk' module PDK class Config class JSON < Namespace # Parses a JSON document. # # @see PDK::Config::Namespace.parse_file def parse_file(filename) raise unless block_given? data = load_data(filename) return if data.nil? || data.empty? require 'json' data = ::JSON.parse(data) return if data.nil? || data.empty? data.each { |k, v| yield k, PDK::Config::Setting.new(k, self, v) } rescue ::JSON::ParserError => e raise PDK::Config::LoadError, e.message end # Serializes object data into a JSON string. # # @see PDK::Config::Namespace.serialize_data def serialize_data(data) require 'json' ::JSON.pretty_generate(data) end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
pdk-3.3.0 | lib/pdk/config/json.rb |
pdk-3.0.1 | lib/pdk/config/json.rb |
pdk-3.0.0 | lib/pdk/config/json.rb |