Exception: CushionDefaults::FrozenDefaultError
- Inherits:
-
RuntimeError
- Object
- RuntimeError
- CushionDefaults::FrozenDefaultError
- Defined in:
- lib/cushion_defaults/errors.rb
Overview
Raised when a program attempts to overwrite a frozen default value.
Instance Attribute Summary collapse
-
#frozen_default_name ⇒ symbol
readonly
The frozen default in #originating_class that the program attempted to override.
-
#originating_class ⇒ Class
readonly
Whose frozen default #frozen_default_name the program tried to override.
Instance Method Summary collapse
-
#initialize(orignating_class, frozen_default_name) ⇒ FrozenDefaultError
constructor
A new instance of FrozenDefaultError.
-
#to_s ⇒ String
Include #originating_class and #frozen_default_name in #to_s.
Constructor Details
#initialize(orignating_class, frozen_default_name) ⇒ FrozenDefaultError
Returns a new instance of FrozenDefaultError.
9 10 11 12 |
# File 'lib/cushion_defaults/errors.rb', line 9 def initialize(orignating_class, frozen_default_name) @originating_class = orignating_class @frozen_default_name = frozen_default_name end |
Instance Attribute Details
#frozen_default_name ⇒ symbol (readonly)
Returns the frozen default in #originating_class that the program attempted to override.
7 8 9 |
# File 'lib/cushion_defaults/errors.rb', line 7 def frozen_default_name @frozen_default_name end |
#originating_class ⇒ Class (readonly)
Returns whose frozen default #frozen_default_name the program tried to override.
5 6 7 |
# File 'lib/cushion_defaults/errors.rb', line 5 def originating_class @originating_class end |
Instance Method Details
#to_s ⇒ String
Include #originating_class and #frozen_default_name in #to_s
16 17 18 |
# File 'lib/cushion_defaults/errors.rb', line 16 def to_s "#{@originating_class}.defaults[:#{@frozen_default_name} is frozen!" end |