I’m adding a new method to the String class in Ruby, How can I get the value of the class?
e.g.:
class String def myMethodName(arguments) # here I want the string value end end puts 'Lennie'.myMethodName() # this should return 'Lennie' or whatever the value of the string is.
Thanks
You should be able to access the actual string value by referring to
self: