C
Christoph Schiessl
For example. Look the following piece of simple Ruby Code:
class ExampleClass
def some_instance_method
'Called some_instace_method!'
end
end
def ExampleClass.i_am_a_class_method
'Called i_am_a_class_method!'
end
inst = ExampleClass.new
def inst.i_am_an_instance_method
'Called i_am_an_instance_method'
end
Basically, I am reopening the definition of ExampleClass and adding
another method. At first I am creating a new class method and
afterwards I am creating a new instance method (for the object inst
only). Is monkey patching the correct term for that kind of
programming style?
How would you call this style of programming? I'm asking because I'm
quite new to Ruby and currently trying to learn the right vocabulary
to easily communicate with other Ruby programmers. I am definitely not
looking for flame war!
Best regards,
Christoph Schiessl
class ExampleClass
def some_instance_method
'Called some_instace_method!'
end
end
def ExampleClass.i_am_a_class_method
'Called i_am_a_class_method!'
end
inst = ExampleClass.new
def inst.i_am_an_instance_method
'Called i_am_an_instance_method'
end
Basically, I am reopening the definition of ExampleClass and adding
another method. At first I am creating a new class method and
afterwards I am creating a new instance method (for the object inst
only). Is monkey patching the correct term for that kind of
programming style?
How would you call this style of programming? I'm asking because I'm
quite new to Ruby and currently trying to learn the right vocabulary
to easily communicate with other Ruby programmers. I am definitely not
looking for flame war!
Best regards,
Christoph Schiessl