Actually it’s almost the same:
my_key = :name
my_hash = { name: 'Joe', age: 52 }
my_hash[my_key]
#=> "Joe"
More Related Contents:
- Unable to eval string with ‘
- Armstrong numbers in ruby
- What is the Ruby (spaceship) operator?
- rbenv not changing ruby version
- ruby floating point errors
- Difference between \A \z and ^ $ in Ruby regular expressions
- What does the “===” operator do in Ruby? [duplicate]
- Ruby operator precedence table
- Ruby – Parameters by reference or by value? [duplicate]
- How to implement Enums in Ruby?
- Ruby MYSQL2 gem installation on windows 7
- How do I remove emoji from string
- Issue updating Ruby on Mac with Xcode 4.3.1
- Ruby multidimensional array
- Failed to build gem native extension (installing Compass)
- Why do I get a “permission denied” error while installing a gem?
- How do I keep the delimiters when splitting a Ruby string?
- How to search a folder and all of its subfolders for files of a certain type
- Why are gems installed in a directory with a different Ruby version than I’m running?
- Shortcut to make case/switch return a value
- What is a regex to match a string NOT at the end of a line?
- How to count duplicates in Ruby Arrays
- Can Ruby print out time difference (duration) readily?
- How do I format a date in ruby to include “rd” as in “3rd”
- Why does “compass watch” say it cannot load sass/script/node (LoadError)?
- When to use `require`, `load` or `autoload` in Ruby?
- Natural Language Processing in Ruby [closed]
- How can I get the absolute URL when extracting links using Nokogiri?
- How to turn a string into a method call? [duplicate]
- What is the behavior when using both positional and keyword arguments in Ruby?