Class: DuckTyper::InterfaceChecker::Result
- Inherits:
-
Object
- Object
- DuckTyper::InterfaceChecker::Result
- Includes:
- ResultFormatting
- Defined in:
- lib/duck_typer/interface_checker/result.rb
Instance Attribute Summary collapse
-
#left ⇒ Object
readonly
Returns the value of attribute left.
-
#right ⇒ Object
readonly
Returns the value of attribute right.
Instance Method Summary collapse
- #diff_message ⇒ Object
- #failure_message ⇒ Object
-
#initialize(left:, right:, match:, diff_message:, name:, strict:) ⇒ Result
constructor
A new instance of Result.
- #match? ⇒ Boolean
Constructor Details
#initialize(left:, right:, match:, diff_message:, name:, strict:) ⇒ Result
Returns a new instance of Result.
12 13 14 15 16 17 18 19 |
# File 'lib/duck_typer/interface_checker/result.rb', line 12 def initialize(left:, right:, match:, diff_message:, name:, strict:) @left = left @right = right @match = match @diff_message = @name = name @strict = strict end |
Instance Attribute Details
#left ⇒ Object (readonly)
Returns the value of attribute left.
10 11 12 |
# File 'lib/duck_typer/interface_checker/result.rb', line 10 def left @left end |
#right ⇒ Object (readonly)
Returns the value of attribute right.
10 11 12 |
# File 'lib/duck_typer/interface_checker/result.rb', line 10 def right @right end |
Instance Method Details
#diff_message ⇒ Object
25 26 27 |
# File 'lib/duck_typer/interface_checker/result.rb', line 25 def @diff_message.call end |
#failure_message ⇒ Object
29 30 31 32 33 34 35 36 37 38 |
# File 'lib/duck_typer/interface_checker/result.rb', line 29 def return if match? <<~MSG Expected #{@left} and #{@right} to implement compatible \ #{interface_label}, but the following method signatures differ:#{strict_note} #{} MSG end |
#match? ⇒ Boolean
21 22 23 |
# File 'lib/duck_typer/interface_checker/result.rb', line 21 def match? @match.call end |