Created
March 3, 2015 14:20
-
-
Save SolomonHD/f7eb2ac73a4d99ecd1b1 to your computer and use it in GitHub Desktop.
03MAR15
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class OddArray | |
def initialize(odd_array) | |
@odd_array = odd_array | |
end | |
def to_a | |
odd_only_array = [] | |
@odd_array.each do |number| | |
if number.class == Fixnum && number.odd? | |
odd_only_array << number | |
end | |
end | |
@odd_array = odd_only_array | |
return @odd_array | |
end | |
def add(number) | |
@odd_array << number | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment