Skip to content

Instantly share code, notes, and snippets.

@BrayanZ
Created May 8, 2013 04:38
Show Gist options
  • Save BrayanZ/5538229 to your computer and use it in GitHub Desktop.
Save BrayanZ/5538229 to your computer and use it in GitHub Desktop.
class Message
attr_reader :status
def initialize
@status = :started
end
def cancel
@status = :canceled
end
# ...
end
class UrgentMessage < Message
attr_reader :status
def cancel
raise ForbiddenCancelError if @status == :started
@status = :canceled
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment