module ActiveRedis::Attributes
Public Class Methods
included(base)
click to toggle source
# File lib/active_redis/attributes.rb, line 7 def self.included(base) base.extend ClassMethods end
Public Instance Methods
attributes()
click to toggle source
# File lib/active_redis/attributes.rb, line 17 def attributes self.class.attributes_list.inject({}) do |hash, attribute| hash[attribute.to_sym] = self.send(attribute.to_s) hash end end
attributes=(value)
click to toggle source
# File lib/active_redis/attributes.rb, line 11 def attributes=(value) raise ActiveRedis::InvalidArgumentError, "Value must be a Hash or Array" if !value.is_a?(Hash) && !value.is_a?(Array) value = Hash[*value] if value.is_a?(Array) value.each { |attribute, value| self.send("#{attribute}=", value) } end