Created
February 25, 2018 14:29
-
-
Save suryart/15d27dca601687e2ad0da1ffa8cd89f1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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