Guest User

Untitled

a guest
Oct 15th, 2018
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.48 KB | None | 0 0
  1. class ComparablePlay
  2. include Comparable
  3.  
  4. attr_accessor :attributes
  5.  
  6. def initialize(attributes = {})
  7. self.attributes = attributes
  8. end
  9.  
  10. def <=>(other_complaint)
  11. attributes.size <=> other_complaint.attributes.size
  12. end
  13. end
  14.  
  15.  
  16. class EnumerablePlay
  17. include Enumerable
  18.  
  19. def initialize(attributes = {})
  20. @attributes = attributes
  21. end
  22.  
  23. def give_me_nothing
  24. reject {|item| item.class == Array}
  25. end
  26.  
  27. def each(&block)
  28. @attributes.each {|k, v| block.call(k, v)}
  29. end
  30. end
Add Comment
Please, Sign In to add comment