Skip to content

Instantly share code, notes, and snippets.

@Marahin
Created October 24, 2018 10:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Marahin/52e8b2aed6469446767c66476298fc1a to your computer and use it in GitHub Desktop.
Save Marahin/52e8b2aed6469446767c66476298fc1a to your computer and use it in GitHub Desktop.
Fridge contents are awesome
def fridge_1_contents
@fridge_1_contents ||= [1].freeze
end
def fridge_2_contents
@frigde_2_contents ||= [2].freeze
end
fridge_3_contents = fridge_1_contents + fridge_2_contents
=> [1, 2]
fridge_3_contents.frozen?
=> false
fridge_1_contents.frozen?
=> true
fridge_2_contents.frozen?
=> true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment