Alias method name : object Creation « Class « Ruby
- Ruby
- Class
- object Creation
Alias method name
class Object
def in(other)
other.include? self
end
end
x = [1, 2, 3]
if 2.in x
puts "yes" # Prints "yes"
else
puts "no"
end
Related examples in the same category