Skip to content

Instantly share code, notes, and snippets.

@tyleramos
Created February 17, 2016 18:59
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 tyleramos/8021f80026af12318455 to your computer and use it in GitHub Desktop.
Save tyleramos/8021f80026af12318455 to your computer and use it in GitHub Desktop.
BadFoo
class BadFoo
@foo = :original
class_attribute :attrs, instance_accessor: false
self.attrs = [:original]
puts "1."
puts "attrs: #{self.attrs} #{self.attrs.object_id}"
puts "@foo: #{@foo} #{@foo.object_id}"
class << self
@foo = :singleton
class_attribute :attrs, instance_accessor: false
self.attrs = [:singleton]
puts "2."
puts "attrs: #{self.attrs} #{self.attrs.object_id}"
puts "@foo: #{@foo} #{@foo.object_id}"
end
puts "3."
puts "attrs: #{self.attrs} #{self.attrs.object_id}"
puts "@foo: #{@foo} #{@foo.object_id}"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment