Skip to content

Instantly share code, notes, and snippets.

View hezbymuhammad's full-sized avatar
:octocat:
Coding

Hezby Muhammad hezbymuhammad

:octocat:
Coding
View GitHub Profile
# --- below is immutable object
:lorem.object_id
# 1190748
:lorem.object_id
# 1190748
1.object_id
# 3
number = 2
number.object_id
# 5
number += 1
number.object_id
# 7
user = {
name: 'John Doe',
address: '282 Kevin Brook, Imogeneborough, CA 58517',
ssn: '2321312313213123',
phone: '123123123',
items: ['purse', 'pants']
}
items = user[:items]
qux = 'lorem'.freeze
qux.object_id
# 70097637306040
quux = 'lorem'.freeze
quux.object_id
# 70097637306040
bar = 'lorem'
bar.object_id
# 70097637306020
baz.object_id
# 70303892908040
baz
# "WORLD world"
baz.upcase!
# "WORLD"
baz.object_id
# 70303892908040
bar << " world"
# "WORLD world"
bar.object_id
foo = 'hello'
bar = 'world'
baz = bar
foo.object_id
# 70303892924240 (this value may different on your machine)
bar.object_id
# 70303892908040