Sha256: 1b265e4be337513b69a0e01e40006afee5a8e41f16b0d9f204872d59e7df2542
Contents?: true
Size: 683 Bytes
Versions: 13
Compression:
Stored size: 683 Bytes
Contents
module Collector module Model def self.included(base) attr_reader :id, :created_at, :updated_at end def initialize(attributes = {}) attributes.each do |key, value| instance_variable_set("@#{key}", value) if methods.include? "#{key}".to_sym send("#{key}=", value) if methods.include? "#{key}=".to_sym end end def touch @created_at ||= Time.now.utc @updated_at = Time.now.utc end def attributes instance_variables.each_with_object({}) do |instance_variable, hash| hash[instance_variable.to_s[1..-1]] = instance_variable_get(instance_variable) end end end end
Version data entries
13 entries across 13 versions & 1 rubygems