Skip to content

Instantly share code, notes, and snippets.

@lokeshh
Created March 27, 2016 14:11
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 lokeshh/1d6b5686dcb5e90d97e0 to your computer and use it in GitHub Desktop.
Save lokeshh/1d6b5686dcb5e90d97e0 to your computer and use it in GitHub Desktop.
module CategoricalData
def size
20
end
end
class Vector
def initialize type = nil
self.extend(CategoricalData) if type == :category
end
def size
10
end
end
a = Vector.new
b = Vector.new :category
a.size
#=> 10
b.size
#=> 20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment