Sha256: 1f29250ab92ce1f7b133cffcd1be852ef227c35ba9dae46154b9136e174c3ee8
Contents?: true
Size: 646 Bytes
Versions: 19
Compression:
Stored size: 646 Bytes
Contents
module Pupa # A minimal model for a foreign object. class ForeignObject extend Forwardable include Concerns::IndifferentAccess attr_reader :attributes, :foreign_keys def_delegators :@attributes, :[], :[]= def initialize(properties = {}) hash = symbolize_keys(properties) value = hash.delete(:foreign_keys) || {} @attributes = hash.merge(value) @foreign_keys = value.keys end def to_h {}.tap do |hash| attributes.each do |property,value| if value == false || value.present? hash[property] = value end end end end end end
Version data entries
19 entries across 19 versions & 1 rubygems