str = “how are you”
name_of_method = “length”
str.name_of_method ####how can i make it work
str = “how are you”
name_of_method = “length”
str.name_of_method ####how can i make it work
Like this:
str = "how are you"
name_of_method = "length"
str.send name_of_method
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.
Sponsor our Newsletter | Privacy Policy | Terms of Service | Remote Ruby Jobs