Skip to content

Instantly share code, notes, and snippets.

@isaacsanders
Created November 26, 2011 23:05
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 isaacsanders/1396463 to your computer and use it in GitHub Desktop.
Save isaacsanders/1396463 to your computer and use it in GitHub Desktop.
Ruby v JS
Foo = function(bar) {
this.bar = bar;
}
foo = new Foo('baz');
foo.bar = 'qux';
// This works.
class Foo; end
foo = Foo.new
foo.bar = :baz
# This raises an exception
class Foo
attr_accessor :bar
end
foo = Foo.new
foo.bar = :baz
# This works. Feels weird.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment