Class: Contracts::DefaultErrorFormatter
- Inherits:
-
Object
- Object
- Contracts::DefaultErrorFormatter
- Defined in:
- lib/contracts/error_formatter.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#data ⇒ Object
Returns the value of attribute data.
Instance Method Summary collapse
-
#initialize(data) ⇒ DefaultErrorFormatter
constructor
A new instance of DefaultErrorFormatter.
- #message ⇒ Object
Constructor Details
#initialize(data) ⇒ DefaultErrorFormatter
Returns a new instance of DefaultErrorFormatter.
22 23 24 |
# File 'lib/contracts/error_formatter.rb', line 22 def initialize(data) @data = data end |
Instance Attribute Details
#data ⇒ Object
Returns the value of attribute data.
21 22 23 |
# File 'lib/contracts/error_formatter.rb', line 21 def data @data end |
Instance Method Details
#message ⇒ Object
26 27 28 29 30 31 32 33 |
# File 'lib/contracts/error_formatter.rb', line 26 def %{#{header} Expected: #{expected}, Actual: #{data[:arg].inspect} Value guarded in: #{data[:class]}::#{method_name} With Contract: #{data[:contracts]} At: #{position} } end |