Skip to content

Instantly share code, notes, and snippets.

@suryart
Created December 7, 2013 11:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save suryart/7839910 to your computer and use it in GitHub Desktop.
Save suryart/7839910 to your computer and use it in GitHub Desktop.
module InstanceModule
def track
"Tracking todo: #{self.name}"
end
end
module ClassModule
def class_name
"Tracking class: #{self.name}"
end
end
class Todo
include InstanceModule
extend ClassModule
attr_reader :name
def initialize(task_name)
@name = task_name
end
end
t = Todo.new('read a blog')
puts t.track
puts Todo.class_name
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment