Guru on Rails

if you don’t sacrifice for your dream then your dream becomes your sacrifice.
Sydney, Sat 01 Jun 2019
Ruby singleton methods
Wed 29 Aug 2018

Let's have a look on how to implement singleton methods in Ruby.

will = 'Will Nguyen'
def will.hello
   puts "#{self} says hello"
end

If we have many methods need to be implemented.

class << will
   def hello1
   end
   def hello2
   end
   def hello3
   end
end

We also can use meta-programming like this.

define_singleton_method("hello#{i}") do
end