Sha256: 746ad90c8e19f89be0ce1754f68b2b3234f52cd5ab5947dc5b7b6a027c76f059
Contents?: true
Size: 575 Bytes
Versions: 10
Compression:
Stored size: 575 Bytes
Contents
module UnifiedDB module Result class Base def self.allowed_keys; []; end def initialize(params) allowed_keys.each do |key| instance_variable_set("@#{key}", params[key]) end end def to_h allowed_keys.inject({}) { |hash, key| hash[key] = instance_variable_get("@#{key}"); hash } end def to_json(*args) UnifiedDB.json_encoder.encode to_h end private def allowed_keys self.class.allowed_keys end end end end
Version data entries
10 entries across 10 versions & 1 rubygems