Player FM 앱으로 오프라인으로 전환하세요!
Favorite Ruby Methods: Part 2 - The Hash
저장한 시리즈 ("피드 비활성화" status)
When? This feed was archived on October 11, 2025 21:10 (). Last successful fetch was on June 06, 2024 13:47 ()
Why? 피드 비활성화 status. 잠시 서버에 문제가 발생해 팟캐스트를 불러오지 못합니다.
What now? You might be able to find a more up-to-date version using the search function. This series will no longer be checked for updates. If you believe this to be in error, please check if the publisher's feed link below is valid and contact support to request the feed be restored or if you have any other concerns about this.
Manage episode 354910871 series 3375882
On this episode of Ruby for All, Julie tells us she’s working on a new app and she’s calling it “Today,” which is going to help her organize her day-to-day tasks. We’re also continuing with our February series talking about different object types in Ruby and our favorite methods with them. Today, we’re talking about the Ruby Hashes, such as merge, fetch, dig, .new, values, transform values, reject, key?, and compact. Hash is so important for Ruby developers, because the more you know, the better you can write. Julie tells us how she couldn’t grasp the Hash object when she first was learning Ruby, and Andrew shares his journey of learning other programming languages before learning Ruby and how it helped him appreciate Ruby. After today, he’s happy to know when to use dig now! Julie and Andrew hope this episode helps you like it’s helped them! Download this episode now find out more!
[00:01:13] Since Julie’s been building a new app for herself to stay organized daily, she tells us about playing around with ChatGPT, and Andrew explains ChatGPT is trained better on source code and other things.
[00:03:10] Andrew talks about GitHub’s Copilot and what it does.
[00:03:55] Our February series is continuing with talking about different object types in Ruby and we’re starting with a Hash, which is a dictionary light collection of unique keys and their values. Also called Associative Arrays, they’re similar to Array, but where an array uses integers its index, a hash allows you to use an object type. Julie wonders if the key can be any object.
[00:10:29] Andrew goes into Hash merge, which returns a new Hash formed by merging each of the other hashes into a copy of self, and he explains why you would merge.
[00:12:26] Andrew uses this next one constantly, Hash fetch, and this one returns the value for a given key if found. Julie seems to like this one, and if you’re building a lot of components, you should check this out.
[00:15:13] Julie brings up Hash dig, which extracts the nested values. We also learn Andrew doesn’t use Dig a lot because he can never remember when he’s supposed to use it!
[00:16:45] The next one is Hash.new, which returns a new empty hash object. Julie and Andrew tell us more about this one. If anyone has a use case for Hash.new and passing in, please let us know.
[00:20:20] Hash values at is the next one, and this returns a new array containing the values for the given keys. Andrew thinks he could use this more than he does.
[00:22:34] Julie explains Hash transform values, which returns a new hash object, and each entry has a key from self, a value provided by the block. How can you use this?
[00:24:28] Next one is Hash reject, which returns a new hash object whose entries are all of those from self for which the block returns false or nil. Julie asks Andrew if we’re rejecting the keys, values, or either.
[00:26:14] We made it to the last two for today! Andrew and Julie discuss Hash key? and Hash compact. Julie likes compact because it’s nice to be able to remove anything with no values.
Panelists:
Andrew Mason
Julie J.
Sponsors:
Links:
69 에피소드
저장한 시리즈 ("피드 비활성화" status)
When? This feed was archived on October 11, 2025 21:10 (). Last successful fetch was on June 06, 2024 13:47 ()
Why? 피드 비활성화 status. 잠시 서버에 문제가 발생해 팟캐스트를 불러오지 못합니다.
What now? You might be able to find a more up-to-date version using the search function. This series will no longer be checked for updates. If you believe this to be in error, please check if the publisher's feed link below is valid and contact support to request the feed be restored or if you have any other concerns about this.
Manage episode 354910871 series 3375882
On this episode of Ruby for All, Julie tells us she’s working on a new app and she’s calling it “Today,” which is going to help her organize her day-to-day tasks. We’re also continuing with our February series talking about different object types in Ruby and our favorite methods with them. Today, we’re talking about the Ruby Hashes, such as merge, fetch, dig, .new, values, transform values, reject, key?, and compact. Hash is so important for Ruby developers, because the more you know, the better you can write. Julie tells us how she couldn’t grasp the Hash object when she first was learning Ruby, and Andrew shares his journey of learning other programming languages before learning Ruby and how it helped him appreciate Ruby. After today, he’s happy to know when to use dig now! Julie and Andrew hope this episode helps you like it’s helped them! Download this episode now find out more!
[00:01:13] Since Julie’s been building a new app for herself to stay organized daily, she tells us about playing around with ChatGPT, and Andrew explains ChatGPT is trained better on source code and other things.
[00:03:10] Andrew talks about GitHub’s Copilot and what it does.
[00:03:55] Our February series is continuing with talking about different object types in Ruby and we’re starting with a Hash, which is a dictionary light collection of unique keys and their values. Also called Associative Arrays, they’re similar to Array, but where an array uses integers its index, a hash allows you to use an object type. Julie wonders if the key can be any object.
[00:10:29] Andrew goes into Hash merge, which returns a new Hash formed by merging each of the other hashes into a copy of self, and he explains why you would merge.
[00:12:26] Andrew uses this next one constantly, Hash fetch, and this one returns the value for a given key if found. Julie seems to like this one, and if you’re building a lot of components, you should check this out.
[00:15:13] Julie brings up Hash dig, which extracts the nested values. We also learn Andrew doesn’t use Dig a lot because he can never remember when he’s supposed to use it!
[00:16:45] The next one is Hash.new, which returns a new empty hash object. Julie and Andrew tell us more about this one. If anyone has a use case for Hash.new and passing in, please let us know.
[00:20:20] Hash values at is the next one, and this returns a new array containing the values for the given keys. Andrew thinks he could use this more than he does.
[00:22:34] Julie explains Hash transform values, which returns a new hash object, and each entry has a key from self, a value provided by the block. How can you use this?
[00:24:28] Next one is Hash reject, which returns a new hash object whose entries are all of those from self for which the block returns false or nil. Julie asks Andrew if we’re rejecting the keys, values, or either.
[00:26:14] We made it to the last two for today! Andrew and Julie discuss Hash key? and Hash compact. Julie likes compact because it’s nice to be able to remove anything with no values.
Panelists:
Andrew Mason
Julie J.
Sponsors:
Links:
69 에피소드
모든 에피소드
×플레이어 FM에 오신것을 환영합니다!
플레이어 FM은 웹에서 고품질 팟캐스트를 검색하여 지금 바로 즐길 수 있도록 합니다. 최고의 팟캐스트 앱이며 Android, iPhone 및 웹에서도 작동합니다. 장치 간 구독 동기화를 위해 가입하세요.