Sha256: 88dc93593870f4034260b722c3b60e8c66c33256743170ac7ac3f636f1a4d100
Contents?: true
Size: 709 Bytes
Versions: 3
Compression:
Stored size: 709 Bytes
Contents
module Notifications class Client class Template FIELDS = %i( id type created_at updated_at created_by version body subject ).freeze attr_reader(*FIELDS) def initialize(notification) FIELDS.each do |field| instance_variable_set(:"@#{field}", notification.fetch(field.to_s, nil)) end end %i( created_at updated_at ).each do |field| define_method field do begin value = instance_variable_get(:"@#{field}") Time.parse value rescue value end end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems