Sha256: aad436aadf949bfb3555bd0836b3c4a06b2f3bf569126f143b9e0c7a9f9c863d
Contents?: true
Size: 847 Bytes
Versions: 8
Compression:
Stored size: 847 Bytes
Contents
module OpenActive module Concerns module JsonLdSerializable def self.included(base) base.extend(ClassMethods) end module ClassMethods def properties @properties ||= begin if superclass.respond_to?(:properties) superclass.properties.clone else {} end end end def property(field, as:) properties[as] = { field: field, } end end def values data = {} self.class.properties.each do |key, field:| data[key] = send(field) end data end def to_h data = {} self.class.properties.each do |_key, field:| data[field] = send(field) end data end end end end
Version data entries
8 entries across 8 versions & 1 rubygems