Sha256: a2d29a7e7dc13fec73cfbbc02f4fd0713fdf5c9cb006323d11180da579561f67
Contents?: true
Size: 797 Bytes
Versions: 1
Compression:
Stored size: 797 Bytes
Contents
# -*- encoding : utf-8 -*- module RedisModelExtension # == Attribues # modul for easier getting all attributes # also for setting ang getting value instance variable module Attributes #take all arguments and send them out def to_arg redis_fields_config.inject({}) do |args, (key, type)| args[key] = self.send(key) args end end alias :args :to_arg #put arguments into json def to_json to_arg.to_json end private # get value from instance variable def value_get name instance_variable_get(:"@#{name}") end # set value into instance variable def value_set name, value instance_variable_set(:"@#{name}", value_parse(value, redis_fields_defaults_config[name])) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
redis-model-extension-0.4.1 | lib/redis-model-extension/attributes.rb |