Module: Deimos::SharedConfig::ClassMethods
- Defined in:
- lib/deimos/shared_config.rb
Overview
need to use this instead of class_methods to be backwards-compatible with Rails 3
Instance Method Summary collapse
- #config ⇒ Hash
-
#key_config(plain: nil, field: nil, schema: nil, none: nil) ⇒ Object
Set key configuration.
-
#namespace(namespace) ⇒ Object
Set the namespace.
-
#schema(schema) ⇒ Object
Set the schema.
Instance Method Details
#config ⇒ Hash
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/deimos/shared_config.rb', line 14 def config return @config if @config @config = { encode_key: true } klass = self.superclass while klass.respond_to?(:config) klass_config = klass.config if klass_config # default is true for this so don't include it in the merge klass_config.delete(:encode_key) if klass_config[:encode_key] @config.merge!(klass_config) if klass.config end klass = klass.superclass end @config end |
#key_config(plain: nil, field: nil, schema: nil, none: nil) ⇒ Object
Set key configuration.
51 52 53 54 55 56 |
# File 'lib/deimos/shared_config.rb', line 51 def key_config(plain: nil, field: nil, schema: nil, none: nil) config[:no_keys] = none config[:encode_key] = !plain && !none config[:key_field] = field&.to_s config[:key_schema] = schema end |
#namespace(namespace) ⇒ Object
Set the namespace.
41 42 43 |
# File 'lib/deimos/shared_config.rb', line 41 def namespace(namespace) config[:namespace] = namespace end |
#schema(schema) ⇒ Object
Set the schema.
35 36 37 |
# File 'lib/deimos/shared_config.rb', line 35 def schema(schema) config[:schema] = schema end |