Exception: Contracts::ContractsNotIncluded
- Inherits:
-
TypeError
- Object
- TypeError
- Contracts::ContractsNotIncluded
- Defined in:
- lib/contracts-ruby2/lib/contracts/errors.rb,
lib/contracts-ruby3/lib/contracts/errors.rb
Overview
Error issued when user haven’t included Contracts in original class but used Contract definition in singleton class
Provides useful description for user of the gem and an example of correct usage.
Constant Summary collapse
- DEFAULT_MESSAGE =
%{In order to use contracts in singleton class, please include Contracts module in original class Example: ```ruby class Example include Contracts # this line is required class << self # you can use `Contract` definition here now end end ```}
Instance Attribute Summary collapse
-
#message ⇒ Object
(also: #to_s)
readonly
Returns the value of attribute message.
Instance Method Summary collapse
-
#initialize(message = DEFAULT_MESSAGE) ⇒ ContractsNotIncluded
constructor
A new instance of ContractsNotIncluded.
Constructor Details
#initialize(message = DEFAULT_MESSAGE) ⇒ ContractsNotIncluded
Returns a new instance of ContractsNotIncluded.
67 68 69 |
# File 'lib/contracts-ruby2/lib/contracts/errors.rb', line 67 def initialize( = DEFAULT_MESSAGE) @message = end |
Instance Attribute Details
#message ⇒ Object (readonly) Also known as: to_s
Returns the value of attribute message.
64 65 66 |
# File 'lib/contracts-ruby2/lib/contracts/errors.rb', line 64 def @message end |