How can I delete some elements from an array and select them?
For example:
class Foo
def initialize
@a = [1,2,3,4,5,6,7,8,9]
end
def get_a
return @a
end
end
foo = Foo.new
b = foo.get_a.sth{ |e| e < 4 }
p b # => [1,2,3]
p foo.get_a # => [4,5,6,7,8,9,10]
What I can use instead of foo.get_a.sth?
@aon the classFoois not doing anything. You should remove it.@a = [1,2,3,4,5,6,7,8,9]is the result of a some process.