Closed gaand closed 7 years ago
Agreed. So get rid of apartment = Hash.new('')
and only do apartment.default = ''
in the demo?
As per conversation with @gaand, apartment = Hash.new('')
is preferred.
@gaand the current code along is
> apartment = {}
=> {}
> apartment = Hash.new
=> {}
> apartment = Hash.new('')
=> {}
> apartment.default = ''
=> ""
> apartment[:address]
=> ""
> apartment[:address] = { street: '255 Long Road', city: 'Awesomeville', bedrooms: 3}
=> {:street=>"255 Long Road", :city=>"Awesomeville", :bedrooms=>3}
> apartment.merge({rent: 1000})
=> {:street=>"255 Long Road", :city=>"Awesomeville", :bedrooms=>3, :rent=>1000}
Based on the issue comments, is it preferable to remove apartment.default = ''
?
So the code-a-long would be:
> apartment = {}
=> {}
> apartment = Hash.new
=> {}
> apartment = Hash.new('')
=> {}
> apartment[:address]
=> ""
> apartment[:address] = { street: '255 Long Road', city: 'Awesomeville', bedrooms: 3}
=> {:street=>"255 Long Road", :city=>"Awesomeville", :bedrooms=>3}
> apartment.merge({rent: 1000})
=> {:street=>"255 Long Road", :city=>"Awesomeville", :bedrooms=>3, :rent=>1000}
Based on the issue comments, is it preferable to remove apartment.default = ''?
That's how I'm reading it. I'll wait for @gaand to chime in.
Thanks for asking before removing something!
That was the intent.
Maybe show that the first and use the second to demonstrates it's value before making use of that value?