Exception: Troupe::ContractViolation

Inherits:
StandardError
  • Object
show all
Defined in:
lib/troupe/contract_violation.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(context = nil, opts = {}) ⇒ ContractViolation

Returns a new instance of ContractViolation.


5
6
7
8
9
10
# File 'lib/troupe/contract_violation.rb', line 5

def initialize(context=nil, opts={})
  @context = context
  @property = opts[:property]
  @message = opts[:message]
  super()
end

Instance Attribute Details

#contextObject (readonly)

Returns the value of attribute context.


3
4
5
# File 'lib/troupe/contract_violation.rb', line 3

def context
  @context
end

#propertyObject (readonly)

Returns the value of attribute property.


3
4
5
# File 'lib/troupe/contract_violation.rb', line 3

def property
  @property
end

Instance Method Details

#messageObject


12
13
14
# File 'lib/troupe/contract_violation.rb', line 12

def message
  @message || "Property '#{property}' violated the interactor's contract."
end