Class: Railsmith::DomainContext Deprecated

Inherits:
Context
  • Object
show all
Defined in:
lib/railsmith/domain_context.rb

Overview

Deprecated.

Use Railsmith::Context instead.

Kept for one major version to allow migration. Will be removed in the next major release.

Instance Attribute Summary

Attributes inherited from Context

#domain

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Context

#[], #blank_domain?, build, current, current=, #current_domain, #initialize, normalize_current_domain, #request_id, #to_h, with

Constructor Details

This class inherits a constructor from Railsmith::Context

Class Method Details

.new(current_domain: nil, meta: {}, **extras) ⇒ Object

Overrides Context.new to:

- emit a class-level deprecation warning
- map the old +meta:+ keyword to top-level extras


12
13
14
15
16
# File 'lib/railsmith/domain_context.rb', line 12

def self.new(current_domain: nil, meta: {}, **extras)
  warn "[DEPRECATION] Railsmith::DomainContext is deprecated; use Railsmith::Context instead."
  merged_extras = (meta || {}).merge(extras)
  super(domain: current_domain, **merged_extras)
end

Instance Method Details

#metaObject

Backward-compatible reader. Returns the stored extras (the former :meta hash).



19
20
21
# File 'lib/railsmith/domain_context.rb', line 19

def meta
  @extras
end