>> a = "class"
>> "foo".send(a)
=> String
>> a = "reverse"
>> "foo".send(a)
=> "oof"
>> a = "something"
>> "foo".send(a)
NoMethodError: undefined method `something' for "foo":String
More Related Contents:
- How to remove empty string in hash
- Strange, unexpected behavior (disappearing/changing values) when using Hash default value, e.g. Hash.new([])
- Difference between “or” and || in Ruby? [duplicate]
- What is Ruby’s double-colon `::`?
- Using do block vs braces {}
- How to generate a random string in Ruby
- How do I convert a String object into a Hash object?
- Trying to learn / understand Ruby setter and getter methods
- Difference between a class and a module
- How do I copy a hash in Ruby?
- Is there a “do … while” loop in Ruby?
- what is the functionality of “&: ” operator in ruby? [duplicate]
- How to update Ruby Version 2.0.0 to the latest version in Mac OSX Yosemite?
- Why does string interpolation work in Ruby when there are no curly braces?
- Ruby Array Initialization [duplicate]
- How to implement an abstract class in Ruby
- What does ‘Monkey Patching’ exactly Mean in Ruby?
- Ruby regular expression using variable name
- Group hashes by keys and sum the values
- Best way to convert strings to symbols in hash
- Is there a performance gain in using single quotes vs double quotes in ruby?
- Generating GUIDs in Ruby
- When is `eval` in Ruby justified?
- How can I install a local gem?
- How to convert a string or integer to binary in Ruby?
- What is the easiest way to remove the first character from a string?
- what is “?” in ruby
- What do `?i` and `?-i` in regex mean?
- When to use ‘self’ in Ruby
- Idiomatic object creation in ruby