Sha256: 3b0ff1a3196c9eac336b38847096839f4f3ce9b812fbabba09d9740f88392444
Contents?: true
Size: 596 Bytes
Versions: 1
Compression:
Stored size: 596 Bytes
Contents
# frozen_string_literal: true module OpenSRF # OpenSRF requests and responses often # take the following form # {"__c": "clasname", "__p": ["all", "the", "data"]} class ClassAndData attr_reader :klass, :data def initialize(klass:, data:) @klass = klass @data = data end def self.parse(hash, path = []) small_json = new(klass: hash['__c'], data: hash['__p']) return small_json if path.empty? key = path.shift parse(small_json.data[key], path) end def to_h { '__c' => @klass, '__p' => @data } end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
evergreen-ils-0.2.0 | lib/opensrf/class_and_data.rb |