Skip to content

Instantly share code, notes, and snippets.

@neektza
Last active April 14, 2017 17:45
Show Gist options
  • Save neektza/eb429c23bd93d1a0cbcd876a4d63e0c0 to your computer and use it in GitHub Desktop.
Save neektza/eb429c23bd93d1a0cbcd876a4d63e0c0 to your computer and use it in GitHub Desktop.
class AddOneTask
@@total = 0
def initialize
puts "Scheduling task"
@performed = false
end
def performed?
@performed
end
def perform
unless performed?
@@total += 1
@performed = true
end
puts "Task performed, state #{@@total}"
self
end
def self.state
@@total
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment