Skip to content

Instantly share code, notes, and snippets.

@edipofederle
Created October 5, 2012 00:44
Show Gist options
  • Select an option

  • Save edipofederle/3837386 to your computer and use it in GitHub Desktop.

Select an option

Save edipofederle/3837386 to your computer and use it in GitHub Desktop.
class Temp
attr_accessor :name
def initialize(name)
@name = name
end
end
a = Temp.new("Edipo")
b = Temp.new("Joao")
def a.new_method
puts "new method for a"
end
#a.send(:new_method) #Dynamically
#closures
second_name = "Jacob"
Temp.send(:define_method, 'second_name') do
puts "#{name} second name is #{second_name}"
end
def max(4)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment