Sha256: bc5f515e5522f9d43e7c2302a02f244e7dfaae17bf43b111ce18961add16ee17
Contents?: true
Size: 629 Bytes
Versions: 1
Compression:
Stored size: 629 Bytes
Contents
require 'equalizer' require 'virtus' require_relative 'uuid' module Kamerling class UUIDEntity include Equalizer.new(:uuid) include Virtus.model attribute :uuid, String, default: -> (*) { UUID.new } def self.attrs(hash = {}) hash.each { |name, klass| attribute name, klass } end def self.defaults(hash = {}) hash.each do |name, default| warn_off { attribute name, attribute_set[name].type, default: default } end end def to_h attributes.map do |key, value| value.is_a?(UUIDEntity) ? [key, value.to_h] : [key, value] end.to_h end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
kamerling-0.0.3 | lib/kamerling/uuid_entity.rb |