Class: DuckTyper::CanonicalInterfaceChecker::Result
- Inherits:
-
Object
- Object
- DuckTyper::CanonicalInterfaceChecker::Result
- Includes:
- ResultFormatting
- Defined in:
- lib/duck_typer/canonical_interface_checker/result.rb
Instance Method Summary collapse
- #failure_message ⇒ Object
-
#initialize(canonical:, results:, name:, strict:) ⇒ Result
constructor
A new instance of Result.
- #match? ⇒ Boolean
Constructor Details
#initialize(canonical:, results:, name:, strict:) ⇒ Result
Returns a new instance of Result.
10 11 12 13 14 15 |
# File 'lib/duck_typer/canonical_interface_checker/result.rb', line 10 def initialize(canonical:, results:, name:, strict:) @canonical = canonical @results = results @name = name @strict = strict end |
Instance Method Details
#failure_message ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/duck_typer/canonical_interface_checker/result.rb', line 21 def return if match? failing = @results.reject(&:match?) <<~MSG Expected all objects to implement compatible \ #{interface_label} defined by #{@canonical}, \ but the following method signatures differ:#{strict_note} #{failing.map(&:).join("\n")} MSG end |
#match? ⇒ Boolean
17 18 19 |
# File 'lib/duck_typer/canonical_interface_checker/result.rb', line 17 def match? @results.all?(&:match?) end |