Skip to content

Instantly share code, notes, and snippets.

@aberant
Created June 1, 2011 20:51
Show Gist options
  • Save aberant/1003283 to your computer and use it in GitHub Desktop.
Save aberant/1003283 to your computer and use it in GitHub Desktop.
you can't freeze constants in ruby
BOB = 3 #=> 3
BOB.freeze #=> 3
BOB = 4 # (irb):4: warning: already initialized constant BOB #=> 4
BOB #=> 4
@toothrot
Copy link

toothrot commented Jun 2, 2011

or constants, for that matter

FOO = "boo" # => "boo"
FOO << "barf" #=> "boobarf"
FOO.freeze # => "boobarf"
FOO << "cats" #TypeError: can't modify frozen string
FOO = "bar" #(irb):13: warning: already initialized constant FOO

@aberant
Copy link
Author

aberant commented Jun 2, 2011 via email

@toothrot
Copy link

toothrot commented Jun 2, 2011

=(

@aberant
Copy link
Author

aberant commented Jun 2, 2011 via email

@toothrot
Copy link

toothrot commented Jun 2, 2011

so i see!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment