Is it possibile to override boolean method like true and false in Ruby?
For example
def true
rand()
end
def false
rand()
end
true #=> 0.7548583661438558
false #=> 0.19239076750079454
If I try the above, I get:
true #=> true
false #=> false
I'm trying to understand where these true, false methods are defined.
I know that && and || can't be overriden, because && and || are short circut operators.
Are true and false similar? or they are written inside Ruby somewhere?
I'm just experimenting with Ruby.