Skip to content

Instantly share code, notes, and snippets.

@flash-gordon
Created April 30, 2015 17:41
Show Gist options
  • Save flash-gordon/491bc57f1749dd3bb4af to your computer and use it in GitHub Desktop.
Save flash-gordon/491bc57f1749dd3bb4af to your computer and use it in GitHub Desktop.
module TestCV
def value=(val)
@@value = val
end
def value
@@value
end
end
class Foo
extend TestCV
self.value = :foo
end
puts 'Foo.value: %s' % Foo.value
class Bar
extend TestCV
self.value = :bar
end
puts 'Bar.value: %s' % Bar.value
puts 'Foo.value: %s' % Foo.value
# Foo.value: foo
# Bar.value: bar
# Foo.value: bar
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment