Боян обнови решението на 27.10.2014 16:58 (преди около 10 години)
+class NumberSet
+ include Enumerable
+ include Filters
+
+ def initialize
+ @numbers = []
+ end
+
+ def <<(number)
+ check = number.to_i
+ if @numbers.include? check == false
+ @numbers.push(number)
+ end
+ end
+
+ def size
+ @size = @numbers.length
+ end
+
+ def empty?
+ @size == 0
+ end
+
+ def [](*filters, array_for_filter)
+ case filters
+ when filters == "Filter" then Filter(array_for_filter)
+ when filters == "Type Filter" then Type_Filter(array_for_filter)
+ when filters == "Sign Filter" then Sign_Filter(array_for_filter)
+ end
+ end
+
+ def each
+ @numbers.each {|number| yield number}
+ end
+
+end
+