K
Kamil
I wish there would be this simple method in the core:
class Object
def in?(an_array)
an_array.include?(self)
end
end
Having that it's nice to write:
a = %w(hello world out there)
puts 'world'.in?(a)
And it works with Interval instance too.
class Object
def in?(an_array)
an_array.include?(self)
end
end
Having that it's nice to write:
a = %w(hello world out there)
puts 'world'.in?(a)
And it works with Interval instance too.