Exception: Plurimath::DeprecationError
- Defined in:
- lib/plurimath/errors/deprecation_error.rb
Constant Summary collapse
- SEVERITY =
:warning
Instance Attribute Summary collapse
-
#feature ⇒ Object
readonly
Returns the value of attribute feature.
-
#remove_in ⇒ Object
readonly
Returns the value of attribute remove_in.
-
#replacement ⇒ Object
readonly
Returns the value of attribute replacement.
-
#since ⇒ Object
readonly
Returns the value of attribute since.
Instance Method Summary collapse
-
#initialize(feature:, message: nil, replacement: nil, since: nil, remove_in: nil) ⇒ DeprecationError
constructor
A new instance of DeprecationError.
- #severity ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(feature:, message: nil, replacement: nil, since: nil, remove_in: nil) ⇒ DeprecationError
Returns a new instance of DeprecationError.
9 10 11 12 13 14 15 16 |
# File 'lib/plurimath/errors/deprecation_error.rb', line 9 def initialize(feature:, message: nil, replacement: nil, since: nil, remove_in: nil) @feature = feature @replacement = replacement @since = since @remove_in = remove_in @user_message = super(to_s) end |
Instance Attribute Details
#feature ⇒ Object (readonly)
Returns the value of attribute feature.
7 8 9 |
# File 'lib/plurimath/errors/deprecation_error.rb', line 7 def feature @feature end |
#remove_in ⇒ Object (readonly)
Returns the value of attribute remove_in.
7 8 9 |
# File 'lib/plurimath/errors/deprecation_error.rb', line 7 def remove_in @remove_in end |
#replacement ⇒ Object (readonly)
Returns the value of attribute replacement.
7 8 9 |
# File 'lib/plurimath/errors/deprecation_error.rb', line 7 def replacement @replacement end |
#since ⇒ Object (readonly)
Returns the value of attribute since.
7 8 9 |
# File 'lib/plurimath/errors/deprecation_error.rb', line 7 def since @since end |
Instance Method Details
#severity ⇒ Object
18 19 20 |
# File 'lib/plurimath/errors/deprecation_error.rb', line 18 def severity SEVERITY end |
#to_s ⇒ Object
22 23 24 25 26 27 28 29 30 31 |
# File 'lib/plurimath/errors/deprecation_error.rb', line 22 def to_s deprecation = "[plurimath][DEPRECATION] #{feature} is deprecated" deprecation = "#{deprecation} since #{since}" if since deprecation = "#{deprecation} and will be removed in #{remove_in}" if remove_in parts = [deprecation] parts << "Use #{replacement} instead" if replacement parts << @user_message if @user_message "#{parts.join('. ')}." end |