Runtime assertions for Ruby literal.fun
ruby
5
fork

Configure Feed

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

Consistent use of `===` instead of `is_a?`

+3 -3
+1 -1
lib/literal/data_structure.rb
··· 46 46 end 47 47 48 48 def ==(other) 49 - other.is_a?(self.class) && other.class.literal_properties.empty? 49 + self.class === other && other.class.literal_properties.empty? 50 50 end 51 51 alias eql? == 52 52
+1 -1
lib/literal/properties.rb
··· 61 61 def literal_properties 62 62 return @literal_properties if defined?(@literal_properties) 63 63 64 - if superclass.is_a?(Literal::Properties) 64 + if Literal::Properties === superclass 65 65 @literal_properties = superclass.literal_properties.dup 66 66 else 67 67 @literal_properties = Literal::Properties::Schema.new
+1 -1
lib/literal/properties/schema.rb
··· 96 96 97 97 def generate_eq(buffer = +"") 98 98 buffer << "def ==(other)\n" 99 - buffer << " return false unless other.is_a?(self.class) && other.class.literal_properties.size == self.class.literal_properties.size\n" 99 + buffer << " return false unless self.class === other && other.class.literal_properties.size == self.class.literal_properties.size\n" 100 100 101 101 sorted_properties = @sorted_properties 102 102 i, n = 0, sorted_properties.size