Sha256: 23a91d1d557540f974bbfed8dfdcac73b846eee9ebbf46d68004432e4521b861

Contents?: true

Size: 1.6 KB

Versions: 3

Compression:

Stored size: 1.6 KB

Contents

# -*- encoding : utf-8 -*-
module RedisModelExtension
  # == Config
  # set private methods for accessing & storing class configurations
  module ClassConfig

    #store informations about saving nil values
    def redis_save_fields_with_nil_conf
      @redis_save_fields_with_nil_conf.nil? ? @redis_save_fields_with_nil_conf = true : @redis_save_fields_with_nil_conf
    end

    #store informations about current class fields settings
    def redis_fields_config
      @redis_model_config ||= {}
    end

    #store informations about current class fields defaults settings
    def redis_fields_defaults_config
      @redis_model_defaults_config ||= {}
    end

    #store informations about current class redis key fields
    def redis_key_config
      @redis_key_config ||= []
    end

    #store informations about current class aliases settings
    def redis_alias_config
      @redis_alias_config ||= {}
    end

    private

    #store informations about all user defined fields settings
    def redis_user_field_config
      @redis_user_field_config ||= []
    end

  end

  # == Config
  # set private methods for accessing class configurations form instance
  module Config
    private 

    # pointer to class settings
    def redis_key_config
      self.class.redis_key_config
    end

    # pointer to class settings
    def redis_fields_config
      self.class.redis_fields_config
    end

    # pointer to class settings
    def redis_fields_defaults_config
      self.class.redis_fields_defaults_config
    end

    # pointer to class settings
    def redis_alias_config
      self.class.redis_alias_config
    end

  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
redis-model-extension-0.4.2 lib/redis-model-extension/config.rb
redis-model-extension-0.4.1 lib/redis-model-extension/config.rb
redis-model-extension-0.4.0 lib/redis-model-extension/config.rb