Runtime assertions for Ruby literal.fun
ruby
5
fork

Configure Feed

Select the types of activity you want to include in your feed.

Use better names in Literal.check

+4 -4
+4 -4
lib/literal.rb
··· 77 77 Literal::Brand.new(...) 78 78 end 79 79 80 - def self.check(actual, expected) 81 - if expected === actual 80 + def self.check(value, type) 81 + if type === value 82 82 true 83 83 else 84 - context = Literal::TypeError::Context.new(expected:, actual:) 85 - expected.record_literal_type_errors(context) if expected.respond_to?(:record_literal_type_errors) 84 + context = Literal::TypeError::Context.new(expected: type, actual: value) 85 + type.record_literal_type_errors(context) if type.respond_to?(:record_literal_type_errors) 86 86 yield context if block_given? 87 87 raise Literal::TypeError.new(context:) 88 88 end