Sha256: 7d0c69f5e99bb8074a43e478c8fe80a67f5cedcf0ea3b35733fc09f957a80e76
Contents?: true
Size: 473 Bytes
Versions: 97
Compression:
Stored size: 473 Bytes
Contents
module Mumuki::Domain::Syncable ## Syncable objects that also declare ## a `resource_fields` method can define `resource_h` ## and `self.slice_resource_h` based on it. module WithResourceFields extend ActiveSupport::Concern def to_resource_h self.class.resource_fields.map { |it| [it, send(it)] }.to_h.compact end class_methods do def slice_resource_h(resource_h) resource_h.slice(*resource_fields) end end end end
Version data entries
97 entries across 97 versions & 2 rubygems