Category: Interview Questions
-
Explain method missing?
If you call a method that doesn’t exist, Ruby calls method_missing.You can override it to handle undefined methods.
-
Duck Typing in Ruby?
In Ruby, type is determined by behavior (methods), not class.If an object can perform required actions, it can be used.
-
Mixins in Ruby?
Ruby does not support multiple inheritance. Instead, it uses Mixins (via include keyword).
-
self in Ruby?
self represents the current object. Inside a class → self refers to the object calling the method. For class methods → self refers to the class itself.
-
What are Symbols in Ruby?
Symbols are immutable, reusable names represented with a colon :.They are faster and consume less memory than strings.